-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
REGR: fix inplace arithmetic operation on Series no longer updating parent DataFrame #37497
REGR: fix inplace arithmetic operation on Series no longer updating parent DataFrame #37497
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.
lgtm merge on green.
@jorisvandenbossche i have no objection if you're just looking for the quickest available fix, but another option is to update NDFrame._inplace_method:
i havent run the full test suite on this yet, but it passes the new test this PR adds and one of the two that this PR xfails. |
That's indeed the case, as I want to have this fixed for 1.1.4, and I am almost off to bed ;-) |
yeah let's just revert this as is to avoid blocking. @jbrockmendel feel free to push your change in a new PR |
or could add the change to _maybe_cache_changed from #36498. The blockers on that PR weren't related to that change. |
@@ -888,6 +888,7 @@ def test_identity_slice_returns_new_object(self): | |||
original_series[:3] = [7, 8, 9] | |||
assert all(sliced_series[:3] == [7, 8, 9]) | |||
|
|||
@pytest.mark.xfail(reason="accidental fix reverted - GH37497") | |||
def test_loc_copy_vs_view(self): |
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.
im inclined to think this test is wrong.
orig = DataFrame(zip(range(3), range(3)), columns=["a", "b"])
df = orig.copy()
ser = df.loc[:, "a"]
ser += 2
tm.assert_frame_equal(df, orig)
df.loc[:, "a"]
is a view on df
, and +=
is specifically an inplace op (as long as it doesnt result in a dtype change). I think df
should be altered.
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.
im inclined to think this test is wrong.
Yep, I had the same feeling: #36498 (comment)
Closing in favor of #37508, which fixes it without reverting the fix in |
Closes #36373
See discussion at #36498 (comment) for reverting the original fix (#30501 for #30484)