-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: add CoW test for setitem with Series being set #51296
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.
small comment,
the # This is inplace comment is a bit confusing, the docstring says it will never try to write into the underlying array
df.isetitem(1, ser) # This is inplace | ||
|
||
ser.loc[0] = 0 | ||
expected = df = DataFrame({"a": [7, 8, 9], "b": np.array([4, 5, 6], dtype=dtype)}) |
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 think you want to remove df here?
The comment in the test was a left-over from copying the previous setitem test, will remove. But the docstring is actually confusing here, because it is an inplace method in the sense that it is updating the object inplace (we listed this method in the "always inplace" bucket in the draft PDEP). It's only not inplace in the sense that it will not update values inplace. |
Yeah good point, a clarification would probably help |
Fixed a small typo/copy paste issue. otherwise good to merge on greenish |
failures were unrelated |
xref #49473
We already have a test for setitem from #50692, but that only handled setting an array (actually, does that copy the array?), and not setting with a pandas object for which we could use lazy copy mechanism.
This is only adding the test, we seem to actually do an eager copy, so room for optimization.