Skip to content

Commit

Permalink
TST: add test for correct behaviour of multiIndex loc with splice (pa…
Browse files Browse the repository at this point in the history
  • Loading branch information
rogimus authored Mar 1, 2022
1 parent 9eb316b commit 53b3dd5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pandas/tests/indexing/multiindex/test_loc.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,18 @@ def test_sorted_multiindex_after_union(self):
result = df.loc["2011-01-01":"2011-01-02"]
tm.assert_frame_equal(result, expected)

def test_loc_no_second_level_index(self):
# GH#43599
df = DataFrame(
index=MultiIndex.from_product([list("ab"), list("cd"), list("e")]),
columns=["Val"],
)
res = df.loc[np.s_[:, "c", :]]
expected = DataFrame(
index=MultiIndex.from_product([list("ab"), list("e")]), columns=["Val"]
)
tm.assert_frame_equal(res, expected)


@pytest.mark.parametrize(
"indexer, pos",
Expand Down

0 comments on commit 53b3dd5

Please sign in to comment.