Skip to content

Commit e9564f4

Browse files
code sample for pandas-dev#46704
1 parent fa01867 commit e9564f4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

bisect/46704.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# BUG: loc with MultiIndex as index is returning incorrect Index #46704
2+
3+
import pandas as pd
4+
5+
print(pd.__version__)
6+
7+
s = pd.DataFrame({"a": [1, 1, 2], "b": [1, 2, 3], "c": ["a", "b", "c"]}).set_index(
8+
["a", "b"]
9+
)["c"]
10+
11+
result = s.loc[(1, slice(None))]
12+
print(result)
13+
14+
expected = s.iloc[:2]
15+
pd.testing.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)