Skip to content

BUG: step with .loc on MultiIndex with list of indexers skips wrong elements #7400

Closed
@shoyer

Description

@shoyer

Setup (shared with #7399):

import pandas as pd
midx = pd.MultiIndex.from_product([range(5), ['a', 'b', 'c']])
s = pd.Series(range(15), midx)
print(s.loc[2:4:2, 'a':'c'])

What I get:

2  a     6
   c     8
3  b    10
4  a    12
   c    14
dtype: int64

What I expected (the step should only apply to the first level):

2  a     6
   b     7
   c     8
4  a    12
   b    13
   c    14
dtype: int64

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIndexingRelated to indexing on series/frames, not to indexes themselvesMultiIndex

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions