Skip to content

DOC: DataFrame.rename Method #47030

Closed
@MischaDy

Description

@MischaDy

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/docs/dev/reference/api/pandas.DataFrame.rename.html#pandas.DataFrame.rename

Documentation problem

The docs for the inplace parameter state: "Whether to return a new DataFrame. (...)". However, it is clear that the boolean has the opposite meaning: If inplace=True, no new DataFrame will be returned and vice versa.

Suggested fix for documentation

Something along the lines of: "Whether not to return a new DataFrame. (...)"
Or, perhaps more intuitively: "Whether to modify the DataFrame passed as input. (...)"
Possibly with an enhancing addition: "Whether to modify the DataFrame passed as input, rather than creating a new one."

These suggestions improve the docs, because the boolean value of inplace then corresponds to rather than opposes the actual actions taken by the result. Skimming the docs, one might think that the parameter does the opposite of what the docs say, despite its name. Or, alternatively, one might stumble when reading it, and get the intended meaning afterwards. In any case, it is an unneeded distraction.

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