Skip to content
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

address copy-on-write-related warnings #119

Merged
merged 1 commit into from
Jul 14, 2024
Merged

address copy-on-write-related warnings #119

merged 1 commit into from
Jul 14, 2024

Conversation

razumau
Copy link
Contributor

@razumau razumau commented Jul 14, 2024

pandas is moving to a copy-on-write model.

From their guide:

CoW means that any DataFrame or Series derived from another in any way always behaves as a copy. As a consequence, we can only change the values of an object through modifying the object itself.

Thus, new_teams["trb"].fillna(0, inplace=True) would not work with CoW (trb would be filled with zeroes only in a copy, not in the original new_teams dataframe).

This can be addressed by using a slightly different syntax for in-place updates.

Migration guide: https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html#copy-on-write-migration-guide

pandas is moving to a copy-on-write model.

From their guide:

> CoW means that any DataFrame or Series derived from another in any way always behaves as a copy. As a consequence, we can only change the values of an object through modifying the object itself.

Thus, `new_teams["trb"].fillna(0, inplace=True)` would not work with CoW (trb would be filled with zeroes only in a copy, not in the original `new_teams` dataframe).

This can be addressed by using a slightly different syntax for in-place updates.

Migration guide: https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html#copy-on-write-migration-guide
@razumau razumau merged commit 3b7b6dc into main Jul 14, 2024
1 check passed
@razumau razumau deleted the cow_pandas branch July 14, 2024 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant