Skip to content

DOC: Unclear documentation of inplace parameter for rename function. #23105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -3828,8 +3828,8 @@ def rename(self, *args, **kwargs):
copy : boolean, default True
Also copy underlying data
inplace : boolean, default False
Whether to return a new DataFrame. If True then value of copy is
ignored.
Modify the DataFrame in place (do not create a new object).
If True then value of copy is ignored.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the new sentence is technically correct. The inplace parameter is misleading, and in many cases the DataFrame is not modified in place, but creating a copy that is assigned to the same variable.

Can you take a look at the parameter inplace of other methods and see what is being used there. It'd be nice to unify them actually (not in this PR).

level : int or level name, default None
In case of a MultiIndex, only rename labels in the specified
level.
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -980,8 +980,8 @@ def rename(self, *args, **kwargs):
copy : boolean, default True
Also copy underlying data
inplace : boolean, default False
Whether to return a new %(klass)s. If True then value of copy is
ignored.
Modify the %(klass)s inplace (do not create a new object).
If True then value of copy is ignored.
level : int or level name, default None
In case of a MultiIndex, only rename labels in the specified
level.
Expand Down