-
-
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
DEPR: df.iloc[:, foo] = bar attempt to set inplace #45333
Conversation
jbrockmendel
commented
Jan 12, 2022
•
edited
Loading
edited
- closes BUG/API: DataFrame.iloc[:, foo] = bar inplaceness? #44353
- tests added / passed
- Ensure all linting tests pass, see here for how to run them
- whatsnew entry
can you rebase |
Made a couple of efforts recently to simplify the |
There's a problem here in that the But getting this done should be a very high priority for 1.5 as its a blocker for all kinds of inconsistency-fixing. |
@jreback in the Feb call i think we agreed to move forward with this but there was some bikeshedding over the name of the replacement method. Do you remember what we landed on? |
@jreback gentle ping, finally green |
thanks @jbrockmendel yeah has been out here for a while :-> followup, i think we need |
* API: New copy / view semantics using Copy-on-Write * fix more tests * Handle CoW in BM.iset * Handle CoW in xs * add bunch of todo comments and usage warnings * Insert None ref in BM.insert * Ensure to not assume copy_on_write is set in case of ArrayManager * Handle refs in BM._combine / test CoW in select_dtypes * handle get_numeric_data for single block manager * fix test_internals (get_numeric_data now uses CoW) * handle refs in consolidation * fix deep=None for ArrayManager * update copy/view tests from other PR * clean-up fast_xs workarounds now it returns a SingleBlockManager * tracks refs in to_frame * fixup after updata main and column_setitem + iloc inplace setitem changes (gh-45333) * fix inplace fillna + fixup new tests * address comments + update some todo comments * Update pandas/core/internals/managers.py Co-authored-by: Matthew Roeschke <[email protected]> * fixup linting * update new copy_view tests to use get_array helper * add comment to setitem * switch default to False, ensure CoW copies only happen when enabled + add additional test build with CoW * update type annotations * Fix stata issue to avoid SettingWithCopyWarning in read_stata * update type + option comment * fixup new rename test Co-authored-by: Matthew Roeschke <[email protected]>
* API: New copy / view semantics using Copy-on-Write * fix more tests * Handle CoW in BM.iset * Handle CoW in xs * add bunch of todo comments and usage warnings * Insert None ref in BM.insert * Ensure to not assume copy_on_write is set in case of ArrayManager * Handle refs in BM._combine / test CoW in select_dtypes * handle get_numeric_data for single block manager * fix test_internals (get_numeric_data now uses CoW) * handle refs in consolidation * fix deep=None for ArrayManager * update copy/view tests from other PR * clean-up fast_xs workarounds now it returns a SingleBlockManager * tracks refs in to_frame * fixup after updata main and column_setitem + iloc inplace setitem changes (pandas-devgh-45333) * fix inplace fillna + fixup new tests * address comments + update some todo comments * Update pandas/core/internals/managers.py Co-authored-by: Matthew Roeschke <[email protected]> * fixup linting * update new copy_view tests to use get_array helper * add comment to setitem * switch default to False, ensure CoW copies only happen when enabled + add additional test build with CoW * update type annotations * Fix stata issue to avoid SettingWithCopyWarning in read_stata * update type + option comment * fixup new rename test Co-authored-by: Matthew Roeschke <[email protected]>
* API: New copy / view semantics using Copy-on-Write * fix more tests * Handle CoW in BM.iset * Handle CoW in xs * add bunch of todo comments and usage warnings * Insert None ref in BM.insert * Ensure to not assume copy_on_write is set in case of ArrayManager * Handle refs in BM._combine / test CoW in select_dtypes * handle get_numeric_data for single block manager * fix test_internals (get_numeric_data now uses CoW) * handle refs in consolidation * fix deep=None for ArrayManager * update copy/view tests from other PR * clean-up fast_xs workarounds now it returns a SingleBlockManager * tracks refs in to_frame * fixup after updata main and column_setitem + iloc inplace setitem changes (pandas-devgh-45333) * fix inplace fillna + fixup new tests * address comments + update some todo comments * Update pandas/core/internals/managers.py Co-authored-by: Matthew Roeschke <[email protected]> * fixup linting * update new copy_view tests to use get_array helper * add comment to setitem * switch default to False, ensure CoW copies only happen when enabled + add additional test build with CoW * update type annotations * Fix stata issue to avoid SettingWithCopyWarning in read_stata * update type + option comment * fixup new rename test Co-authored-by: Matthew Roeschke <[email protected]>
## Why are these changes needed? To upgrade to py312 we need to upgrade to `pandas>=2.0.0`. This upgrade introduced a breaking change in the syntax of some of our code / tests: > Changed behavior in setting values with df.loc[:, foo] = bar or df.iloc[:, foo] = bar, these now always attempt to set values inplace before falling back to casting ([GH 45333](pandas-dev/pandas#45333)) As a result we needed to update these uses of loc to do direct assignment. ## Related issue number <!-- For example: "Closes #1234" --> ## Checks - [ ] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [ ] I've run `scripts/format.sh` to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [ ] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [ ] Unit tests - [ ] Release tests - [ ] This PR is not tested :( Signed-off-by: Matthew Owen <[email protected]>
To upgrade to py312 we need to upgrade to `pandas>=2.0.0`. This upgrade introduced a breaking change in the syntax of some of our code / tests: > Changed behavior in setting values with df.loc[:, foo] = bar or df.iloc[:, foo] = bar, these now always attempt to set values inplace before falling back to casting ([GH 45333](pandas-dev/pandas#45333)) As a result we needed to update these uses of loc to do direct assignment. <!-- For example: "Closes #1234" --> - [ ] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [ ] I've run `scripts/format.sh` to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [ ] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [ ] Unit tests - [ ] Release tests - [ ] This PR is not tested :( Signed-off-by: Matthew Owen <[email protected]> Signed-off-by: can <[email protected]>