Skip to content

Commit 684a03e

Browse files
committed
TST: Adds test for .loc on series with multiindex containing tuple as label (pandas-dev#43908)
1 parent b159c75 commit 684a03e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pandas/tests/indexing/multiindex/test_loc.py

+9
Original file line numberDiff line numberDiff line change
@@ -912,3 +912,12 @@ def test_loc_keyerror_rightmost_key_missing():
912912
df = df.set_index(["A", "B"])
913913
with pytest.raises(KeyError, match="^1$"):
914914
df.loc[(100, 1)]
915+
916+
917+
def test_multindex_series_loc_with_tuple_label():
918+
# GH#43908
919+
mi = MultiIndex.from_tuples([(1, 2), (3, (4, 5))])
920+
ser = Series([1, 2], index=mi)
921+
expected = 2
922+
result = ser.loc[(3, (4, 5))]
923+
assert result == expected

0 commit comments

Comments
 (0)