-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: elaborate on copies vs in place operations in comparison docs #38994
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
Conversation
|
||
sorted_df = df.sort_values("col1") | ||
|
||
* Use the ``inplace=True`` keyword argument, where available |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
frown on this
in place is never recommended
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few options:
- Say "in order of preference"
- Mention
inplace
as "you will come across this, but don't use it" - Remove mention entirely
Strong feelings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i ok with mentioning it, but put it in a note and point to this link: https://pandas.pydata.org/pandas-docs/dev/user_guide/indexing.html#indexing-view-versus-copy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, though the "Returning a view versus a copy" section doesn't actually mention inplace
. I'd submit a pull request to add an explanation, but frankly, that's one area of pandas that's still pretty fuzzy to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure that would be great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I mean is "I'm not sure I understand it fully myself, so would love an explanation from someone else" 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh i c. check this blog by @TomAugspurger https://tomaugspurger.github.io/method-chaining.html
generaly inplace
doesn't do a whole lot, is not idiomatic, and cause copy/view issues.
also pls merge master |
698a3d1
to
0ff288c
Compare
thanks ! |
closes #xxxxwhatsnew entry