Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BUG: fix .loc.__setitem__ not raising when using too many indexers #44656
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
BUG: fix .loc.__setitem__ not raising when using too many indexers #44656
Changes from 3 commits
ca37c9c
c34acb2
d886470
5bae428
06eb7e4
453e3ba
8c53bba
8e44463
e5a768f
7880015
f83cfc8
b5c664d
f7bc4a0
8daced5
3ebf788
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Note the difference in error between
ser.iloc[keys] = 1000
andser.iloc[keys]
.IndexError
is the result of the fact that we let numpy handle this, while pandas raisesIndexingError
. I was wondering if this should be made consistent? Us catching and re-raising from numpy seems ugly.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.
cc @jbrockmendel
but @DriesSchaumont I think we would want to catch that case & re-raise appropriately
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.
IIRC a while back we removed some checks (for perf) and let numpy exceptions surface.
Not knowing anything about the specific use case, in cases where we have a choice between raising IndexError vs IndexingError (i.e. either would be a reasonable choice) I'd rather raise IndexError.
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.
can use indexer_sli fixture to share this test with the iloc one i think
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.
Done, also moved the tests.