Skip to content

BUG/API: bug in multi-index slicing with missing indexers #7866

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

Closed
jreback opened this issue Jul 29, 2014 · 0 comments · Fixed by #7867
Closed

BUG/API: bug in multi-index slicing with missing indexers #7866

jreback opened this issue Jul 29, 2014 · 0 comments · Fixed by #7867
Labels
API Design Bug Indexing Related to indexing on series/frames, not to indexes themselves MultiIndex
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented Jul 29, 2014

I think the following could work and not raise KeyError because of a missing indexer. This would follow the API of loc which will be effectively a reindex as long as you have at least 1 found value.

s = pd.Series(np.arange(9),index=pd.MultiIndex.from_product([['A','B','C'],['foo','bar','baz']],names=['one','two'])).sortlevel()

s.loc[['A','D']]

idx = pd.IndexSlice
s.loc[idx[:,['foo','bah']]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Bug Indexing Related to indexing on series/frames, not to indexes themselves MultiIndex
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant