-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
CoW: Add warning for chained assignment with fillna #53779
Conversation
@jorisvandenbossche I'd appreciate if you can take a look locally, I can't reproduce these failures on Mac |
i get similar-looking failures on mac |
Arm or intel? Purged environment and still can't reproduce... |
intel |
Hm shit. Thx for checking |
This is Python version specific unfortunately... 3.10 has a different ref count compared to 3.11 |
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.
Looks good!
df = DataFrame({"a": [1, np.nan, 2], "b": 1}) | ||
df_orig = df.copy() | ||
if using_copy_on_write: | ||
with tm.assert_produces_warning(ChainedAssignmentError): |
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.
There is a helper for this, with tm.raises_chained_assignment_error():
, which will take care of the fact that it doesn't raise a warning on PyPy
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.
thx
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.