-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CoW: Warn for cases that go through putmask #56168
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
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.
With #55522, we will also have to pass down whether we already warned about chained assignment
pandas/core/internals/base.py
Outdated
class _AlreadyWarned: | ||
def __init__(self): | ||
self.warned_already = False |
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.
Can you add a small comment here about why such a class is needed (in contrast to a simple boolean argument)?
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.
added
# Conflicts: # pandas/tests/indexing/test_chaining_and_caching.py
df.clip(lower=2, inplace=True) | ||
if warn_copy_on_write: | ||
with tm.assert_cow_warning(): | ||
df.clip(lower=2, inplace=True) |
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.
Should this ideally give a more specific warning about an inplace method?
Because right now this gives the general setting on a view warning
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 we can change the message
Co-authored-by: Joris Van den Bossche <[email protected]>
Yeah message sounds good, we can always iterate again if needed |
I added a small commit to do this, the other comments we can address in follow-ups |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.Open for suggestions how we can improve the put mask mechanism to avoid duplicate warnings
xref #56019