Skip to content

Commit eaf0f31

Browse files
update code sample for pandas-dev#38523
1 parent 103fb7c commit eaf0f31

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

bisect/38523.py

+19-8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import sys
2+
13
import pandas as pd
24

35
print(pd.__version__)
@@ -12,16 +14,25 @@
1214
result = df.groupby(level=0)["Max Speed"].rolling(2).sum()
1315
print(result)
1416

17+
# expected = pd.MultiIndex.from_tuples(
18+
# [
19+
# ("Falcon", "Falcon", "Captive"),
20+
# ("Falcon", "Falcon", "Wild"),
21+
# ("Parrot", "Parrot", "Captive"),
22+
# ("Parrot", "Parrot", "Wild"),
23+
# ],
24+
# names=["Animal", "Animal", "Type"],
25+
# )
26+
1527
expected = pd.MultiIndex.from_tuples(
16-
[
17-
("Falcon", "Falcon", "Captive"),
18-
("Falcon", "Falcon", "Wild"),
19-
("Parrot", "Parrot", "Captive"),
20-
("Parrot", "Parrot", "Wild"),
21-
],
22-
names=["Animal", "Animal", "Type"],
28+
[("Falcon",), ("Falcon",), ("Parrot",), ("Parrot",)], names=["Animal"]
2329
)
2430

2531
import pandas.testing as tm
2632

27-
tm.assert_index_equal(result.index, expected)
33+
try:
34+
tm.assert_index_equal(result.index, expected)
35+
except AssertionError:
36+
pass
37+
else:
38+
sys.exit(1)

0 commit comments

Comments
 (0)