We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9eb316b commit 53b3dd5Copy full SHA for 53b3dd5
pandas/tests/indexing/multiindex/test_loc.py
@@ -402,6 +402,18 @@ def test_sorted_multiindex_after_union(self):
402
result = df.loc["2011-01-01":"2011-01-02"]
403
tm.assert_frame_equal(result, expected)
404
405
+ def test_loc_no_second_level_index(self):
406
+ # GH#43599
407
+ df = DataFrame(
408
+ index=MultiIndex.from_product([list("ab"), list("cd"), list("e")]),
409
+ columns=["Val"],
410
+ )
411
+ res = df.loc[np.s_[:, "c", :]]
412
+ expected = DataFrame(
413
+ index=MultiIndex.from_product([list("ab"), list("e")]), columns=["Val"]
414
415
+ tm.assert_frame_equal(res, expected)
416
+
417
418
@pytest.mark.parametrize(
419
"indexer, pos",
0 commit comments