-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
API: consistency in .loc indexing when no values are found in a list-like indexer GH7999) #8003
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
@jorisvandenbossche this also fixes the case we talked about (forgot where), in a multiindex when no values are found it will now raise KeyError (I think it would return the original previously) |
@jreback Did you also fix the inconsistency between Secondly, you now solve the inconsistency between |
yes, this fixed In [1]: df = DataFrame([['a'],['b']],index=[1,2]) In [2]: df
The reason I think that the indexer works liek this is: say you have a big list of labels you are getting. It is better to have it work then raise if 1 is off (and just reindex). Conversely if nothing is found user prob screwed up so This PR doesn't really change much, just makes things consistent (wether you specify all axes or not). |
@jreback yes, that makes sense. The only 'pity' is that it is a deviation from reindex, because if you say " For |
cc @ruidc going to do a do modification? (to include the un-documented prior behavior) @jorisvandenbossche yeah I know this is different than |
So, for the whatsnew: just something like (after the other one): |
ok, sure |
ok, updated |
just a typo: line 1254 of indexing.py: |
…like indexer (GH7999)
API: consistency in .loc indexing when no values are found in a list-like indexer GH7999)
closes #7999