Skip to content

Unclear documentation of inplace parameter for pandas.DataFrame.rename. #23076

@antomaly

Description

@antomaly

Problem description

The documentation for pandas.DataFrame.rename currently reads

inplace : boolean, default False

Whether to return a new DataFrame. If True then value of copy is ignored.

The sentence "Whether to return a new DataFrame" suggests that setting this parameter to True means a new DataFrame will be returned. The parameter name "inplace" suggests that setting this parameter to True means a new DataFrame will not be returned, which is actually the case.

The only thing in the documentation which concretely specifies the true behavior is the parameter name.

A possible alternate phrasing which suggests the correct thing would be to replace the sentence "Whether to return a new DataFrame" with something like "Modify the DataFrame, instead of returning a new DataFrame."

Same thing for the base class NDFrame and its other derived classes like Panel.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions