-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Raise KeyError when indexing a Series with MultiIndex #26155
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
Conversation
Hello @ryanreh99! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2019-04-24 14:32:03 UTC |
Codecov Report
@@ Coverage Diff @@
## master #26155 +/- ##
==========================================
- Coverage 92% 91.98% -0.02%
==========================================
Files 175 175
Lines 52371 52378 +7
==========================================
- Hits 48184 48182 -2
- Misses 4187 4196 +9
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #26155 +/- ##
==========================================
- Coverage 91.98% 91.97% -0.02%
==========================================
Files 175 175
Lines 52371 52375 +4
==========================================
- Hits 48175 48171 -4
- Misses 4196 4204 +8
Continue to review full report at Codecov.
|
1800e1b
to
0369704
Compare
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.
you additions make this way more complicated, see if you can simplify
b2c6375
to
0f85550
Compare
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.
pls add a whatsnew note in bug fixes; indexing section. the code change looks good.
ec751dc
to
467e1e7
Compare
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.
small comments, ping on green.
hello @jreback ping |
doc/source/whatsnew/v0.25.0.rst
Outdated
@@ -327,6 +327,7 @@ Indexing | |||
^^^^^^^^ | |||
|
|||
- Improved exception message when calling :meth:`DataFrame.iloc` with a list of non-numeric objects (:issue:`25753`). | |||
- Bug in :meth:`DataFrame.loc` and :meth:`Series.loc` where KeyError was not raised for a ``MultiIndex``. Now, IndexingError takes precedence over KeyError (:issue:`14885`). |
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.
use double backticks on KeyError; use :class:`MultiIndex`
; maybe something more like
Bug in :meth:DataFrame.loc
and :meth:Series.loc
where KeyError
was not raised for a MultiIndex
when the key was longer that the number of levels in the :class:MUutiIndex. (:issue:14885
).
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.
@jreback actually when key is longer than the levels of the multiindex IndexingError: Too many indexers
was raised and is still raised. So would this be more proper?
Bug in :meth:`DataFrame.loc` and :meth:`Series.loc` where ``KeyError`` was not raised for a ``MultiIndex`` when the key was less than or equal to the number of levels in the :class:`MultiIndex` (:issue:`14885`).
made a change to the if statement as a |
thanks @ryanreh99 very nice |
@jreback thanks for all the help :D |
git diff upstream/master -u -- "*.py" | flake8 --diff