-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
Deprecate DataFrame indexer for iloc setitem and getitem #39022
Conversation
phofl
commented
Jan 7, 2021
•
edited
Loading
edited
- closes BUG: IndexError: positional indexers are out-of-bounds iloc boolean indexing #39004
- tests added / passed
- Ensure all linting tests pass, see here for how to run them
- whatsnew entry
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.
See my note on the PR: #39004 (comment)
In addition, if we disallow this, I think it should be deprecated first for assignment (since that case was working right now)
this is reasonable to deprecate for setitem and simply raise for getitem. @phofl if you can amend. though I am tempted to simply call this a bug fix if setitem actually gives wrong behavior? (or is it actually somewhat correct?) |
Don't know if I would call this wrong. It is counterintuitive for sure. If you know that iloc does not align, you may expect the result, Additionally it only works if indexer has the same dimension as the object to index. Will add a DeprecationWarning |
FutureWarning but thanks |
Added the Warning |
Co-authored-by: Jeff Reback <jeff@reback.net>
Co-authored-by: Jeff Reback <jeff@reback.net>
Added a deprecation whatsnew |
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.
lgtm tiny comment
pandas/core/indexing.py
Outdated
"DataFrame indexer for .iloc is deprecated and will be removed in" | ||
"a future version.\n" | ||
"consider using .loc with a DataFrame indexer for automatic alignment." | ||
"a future version", |
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.
repeated 'a future version'
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.
Thx, changed
@jreback green |
Let's give this a bit more time, since the discussion in #39004 is still ongoing |
� Conflicts: � doc/source/whatsnew/v1.3.0.rst
� Conflicts: � doc/source/whatsnew/v1.3.0.rst
@phofl conflict and if you can rebase. i think this is fine to merge. |
� Conflicts: � doc/source/whatsnew/v1.3.0.rst
Done, failure unrelated |
this looks fine to me. @jorisvandenbossche are you still objecting? |
@phofl can you merge master and update |
@jreback merged master, failure unrelated |
everyone ok here ? |
LGTM |
� Conflicts: � pandas/tests/indexing/test_iloc.py
Are we good here? |
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.
lgtm. ping on greenish
@jreback greenish |
thanks @phofl |