Skip to content

Commit

Permalink
TST: Adds test for .loc on series with multiindex containing tuple as…
Browse files Browse the repository at this point in the history
… label (pandas-dev#43908)
  • Loading branch information
KoenSR committed Oct 14, 2021
1 parent b159c75 commit 684a03e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pandas/tests/indexing/multiindex/test_loc.py
Original file line number Diff line number Diff line change
Expand Up @@ -912,3 +912,12 @@ def test_loc_keyerror_rightmost_key_missing():
df = df.set_index(["A", "B"])
with pytest.raises(KeyError, match="^1$"):
df.loc[(100, 1)]


def test_multindex_series_loc_with_tuple_label():
# GH#43908
mi = MultiIndex.from_tuples([(1, 2), (3, (4, 5))])
ser = Series([1, 2], index=mi)
expected = 2
result = ser.loc[(3, (4, 5))]
assert result == expected

0 comments on commit 684a03e

Please sign in to comment.