Skip to content

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

@toobaz

Description

@toobaz
Member

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.

Activity

added this to the 0.21.1 milestone on Oct 3, 2017
jreback

jreback commented on Apr 14, 2018

@jreback
Contributor

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

added a commit that references this issue on Apr 20, 2018
2d44804
added 2 commits that reference this issue on Apr 22, 2018
171600d
9ec8270
added a commit that references this issue on May 1, 2018
901fc64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DeprecateFunctionality to remove in pandasIndexingRelated to indexing on series/frames, not to indexes themselvesMultiIndex

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Participants

      @jreback@jorisvandenbossche@toobaz

      Issue actions

        No warning is raised by MultiIndex when .loc is called with list containing missing keys · Issue #17758 · pandas-dev/pandas