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

No warning is raised by MultiIndex when .loc is called with list containing missing keys #17758

Closed
toobaz opened this Issue Oct 3, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@toobaz
Member

toobaz commented Oct 3, 2017

Code Sample, a copy-pastable example if possible

From #17295 (comment)

In [2]: pd.DataFrame([[i] for i in range(3)], index=pd.MultiIndex.from_product([[1], [5,6,7]])).loc[[(1,5), (3,7)]]
Out[2]: 
       0
1 5  0.0
3 7  NaN

Problem description

#17295 introduced a warning when obj.loc[a_list] is called with a_list containing keys not in obj.index, but only applies to flat Indexes. MultiIndexes need an analogous PR.

Expected Output

The same, but with a FutureWarning.

@jreback

This comment has been minimized.

Contributor

jreback commented Apr 14, 2018

@toobaz would you be able to push a PR for this?

toobaz added a commit to toobaz/pandas that referenced this issue Apr 20, 2018

toobaz added a commit to toobaz/pandas that referenced this issue Apr 22, 2018

toobaz added a commit to toobaz/pandas that referenced this issue Apr 22, 2018

TomAugspurger added a commit that referenced this issue May 1, 2018

Emit warning for missing labels in Multiindex.loc[[...]] (and more) (#…
…20770)

* API: emit warning to raise KeyError in the future for missing keys also for MultiIndex

closes #17758
closes #20748
closes #20753

@jsexauer jsexauer referenced this issue May 2, 2018

Open

DEPR: deprecations from prior versions #6581

0 of 82 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment