Skip to content

DOC: DataFrame.rename Method #47030

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
1 task done
MischaDy opened this issue May 15, 2022 · 6 comments · Fixed by #47122
Closed
1 task done

DOC: DataFrame.rename Method #47030

MischaDy opened this issue May 15, 2022 · 6 comments · Fixed by #47122

Comments

@MischaDy
Copy link

MischaDy commented May 15, 2022

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.

@MischaDy MischaDy added Docs Needs Triage Issue that has not been reviewed by a pandas team member labels May 15, 2022
@simonjayhawkins
Copy link
Member

Thanks @MischaDy for the report.

Possibly with an enhancing addition: "Whether to modify the DataFrame passed as input, rather than creating a new one."

This is the most explicit but the DataFrame is not technically passed by the user, only internally as self?

so maybe just "Whether to modify the DataFrame rather than creating a new one."

we use the inplace parameter in several methods, so any changes should be consistent across all methods.

contributions and PRs welcome.

@simonjayhawkins simonjayhawkins added good first issue and removed Needs Triage Issue that has not been reviewed by a pandas team member labels May 15, 2022
@simonjayhawkins simonjayhawkins added this to the Contributions Welcome milestone May 15, 2022
@MischaDy
Copy link
Author

Thanks @simonjayhawkins for the super-quick reply!

This is the most explicit but the DataFrame is not technically passed by the user, only internally as self?

Yes, that's correct, my bad.

so maybe just "Whether to modify the DataFrame rather than creating a new one."

Yes, I think that's the best option!

we use the inplace parameter in several methods, so any changes should be consistent across all methods.

I totally agree, this was just the first method I noticed this for.

contributions and PRs welcome.

Oh, I can directly modify the docs and then do a pull request? If so, I'll be happy to do so :)

@MischaDy MischaDy reopened this May 15, 2022
Lily-f pushed a commit to Lily-f/pandas that referenced this issue May 16, 2022
@simonjayhawkins
Copy link
Member

Oh, I can directly modify the docs and then do a pull request? If so, I'll be happy to do so :)

see https://pandas.pydata.org/pandas-docs/dev/development/contributing_documentation.html#contributing-to-the-documentation

@Sumanth077
Copy link

Hi @MischaDy @simonjayhawkins I would like to Contribute, is this Issue still open?

@MischaDy
Copy link
Author

MischaDy commented May 23, 2022

Hi @Sumanth077, yes I think so! There should be quite a few more methods using inplace that can be adapted.

@MischaDy MischaDy reopened this May 23, 2022
@rohit18115
Copy link

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants