Skip to content

Commit 70a17e1

Browse files
add periodindex loc test
1 parent 088a4b6 commit 70a17e1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pandas/tests/indexing/test_loc.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2878,6 +2878,13 @@ def test_loc_set_int_dtype():
28782878
tm.assert_frame_equal(df, expected)
28792879

28802880

2881+
def test_loc_periodindex_3_levels():
2882+
# GH#24091
2883+
p_index = PeriodIndex(["20181101 1100", "20181101 1200", "20181102 1300", "20181102 1400"], name='datetime', freq="B")
2884+
mi_series = DataFrame([["A", "B", 1.0], ["A", "C", 2.0], ["Z", "Q", 3.0], ["W", "F", 4.0]], index=p_index, columns=["ONE", "TWO", "VALUES"])
2885+
mi_series = mi_series.set_index(["ONE", "TWO"], append=True)["VALUES"]
2886+
assert mi_series.loc[(p_index[0], "A", "B")] == 1.0
2887+
28812888
class TestLocSeries:
28822889
@pytest.mark.parametrize("val,expected", [(2**63 - 1, 3), (2**63, 4)])
28832890
def test_loc_uint64(self, val, expected):

0 commit comments

Comments
 (0)