Skip to content

CoW warning mode: clean-up some TODOs #56080

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

Merged
merged 3 commits into from
Nov 20, 2023

Conversation

jorisvandenbossche
Copy link
Member

@jorisvandenbossche jorisvandenbossche commented Nov 20, 2023

xref #56019

Going through some of the TODOs, removing a few that have been tackled in the meantime and adding some more detail to others.

Also went through every test in pandas/tests/copy_view/test_indexing.py and ensured that each test is correctly asserting a warning (or not), or has a TODO(CoW-warn) if that's not yet the case.

@jorisvandenbossche jorisvandenbossche added Warnings Warnings that appear or should be added to pandas Copy / view semantics labels Nov 20, 2023
# TODO(CoW-warn) should warn
if using_copy_on_write or warn_copy_on_write:
subset["a"] = arr
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are replacing a full column (so never updating the original), so while this gives a SettingWithCopyWarning right now, we don't have to warn anything here for CoW

Comment on lines -515 to 514
# TODO(CoW-warn) should warn
if using_copy_on_write or warn_copy_on_write:
subset[["a", "c"]] = 0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly here, replacing full columns, so don't have to warn

@phofl phofl added this to the 2.2 milestone Nov 20, 2023
@phofl phofl merged commit e7fa8bb into pandas-dev:main Nov 20, 2023
@phofl
Copy link
Member

phofl commented Nov 20, 2023

thx @jorisvandenbossche

phofl pushed a commit to phofl/pandas that referenced this pull request Nov 21, 2023
@jorisvandenbossche jorisvandenbossche deleted the cow-warnings-cleanup branch November 27, 2023 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Copy / view semantics Warnings Warnings that appear or should be added to pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants