-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
ENH/CoW: use lazy copy in set_axis method #49600
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.
no objections, over to @jorisvandenbossche
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! Just the comment to add a variant of the test for Series as well
assert not np.shares_memory(get_array(df2, "a"), get_array(df, "a")) | ||
|
||
# mutating df2 triggers a copy-on-write for that column / block | ||
df2.iloc[0, 1] = 0 |
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.
df2.iloc[0, 1] = 0 | |
df2.iloc[0, 0] = 0 |
(just to keep it as simple as possible, for this test there is no reason to not take the first value/column)
And you will also have to merge the main branch, to resolve the conflict from merging your other PR |
@Th3nn3ss small reminder in case you have time to update for the minor comments above |
sorry about the delay @jorisvandenbossche I was preoccupied with my research project. I have made some changes. Thanks for taking a look at my PR. |
30d680e
to
f5e1d5e
Compare
Thx @Th3nn3ss |
Copy-on-Write in
set_axis
This PR is part of an effort to implement the Copy-on-Write implementation mentioned in ENH / CoW: Use the "lazy copy" (with Copy-on-Write) optimization in more methods where appropriate #49473. More detail in this proposal https://docs.google.com/document/d/1ZCQ9mx3LBMy-nhwRl33_jgcvWo9IWdEfxDNQ2thyTb0/edit / with discussions in Proposal for future copy / view semantics in indexing operations #36195