-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
GH 25298: Add test for interval index in multiindex #62794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 7 commits
276211a
2f5fa2a
6f6e0f6
0325998
456ae7c
a7e9a4e
73cea1f
cf10cf7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -222,3 +222,13 @@ def test_reindex_behavior_with_interval_index(self, base): | |
| expected_result = Series([np.nan, 0], index=[np.nan, 1.0], dtype=float) | ||
| result = ser.reindex(index=[np.nan, 1.0]) | ||
| tm.assert_series_equal(result, expected_result) | ||
|
|
||
| def test_multiindex_with_interval_index(self): | ||
| # for GH#25298 | ||
| intIndex = IntervalIndex.from_arrays([1, 5, 8, 13, 16], [4, 9, 12, 17, 20]) | ||
| multiIndex = pd.MultiIndex.from_arrays([["a", "a", "b", "b", "c"], intIndex]) | ||
| data = [(1, 2), (3, 4), (5, 6), (7, 8), (9, 10)] | ||
| df = DataFrame(data, index=multiIndex) | ||
| result1 = df.loc[("b", 16)] | ||
| expected = Series([7, 8]) | ||
| tm.assert_series_equal(result1, expected, check_names=False) | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@harinik, one small comment: could you please rename
result1toresult?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done