-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Fix df.loc slice support #18703
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
Changes from all commits
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 |
---|---|---|
|
@@ -239,6 +239,15 @@ def test_iloc_getitem_multiindex(self): | |
xp = mi_labels.ix['j'].ix[:, 'j'].ix[0, 0] | ||
assert rs == xp | ||
|
||
# GH8856 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make separate test |
||
s = pd.Series(np.arange(10), | ||
pd.MultiIndex.from_product(([0, 1], list('abcde')))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can u add several cases using slices also if other testing of slice u can pull to this section |
||
result = s.iloc[::4] | ||
expected = pd.Series(np.array([0, 4, 8]), | ||
MultiIndex(levels=[[0, 1], list('ade')], | ||
labels=[[0, 0, 1], [0, 2, 1]])) | ||
tm.assert_series_equal(result, expected) | ||
|
||
def test_loc_multiindex(self): | ||
|
||
mi_labels = DataFrame(np.random.randn(3, 3), | ||
|
@@ -278,6 +287,15 @@ def test_loc_multiindex(self): | |
xp = mi_int.ix[4] | ||
tm.assert_frame_equal(rs, xp) | ||
|
||
# GH8856 | ||
s = pd.Series(np.arange(10), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this a duplicate of the other test? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ( |
||
pd.MultiIndex.from_product(([0, 1], list('abcde')))) | ||
result = s.loc[::4] | ||
expected = pd.Series(np.array([0, 4, 8]), | ||
MultiIndex(levels=[[0, 1], ['a', 'd', 'e']], | ||
labels=[[0, 0, 1], [0, 2, 1]])) | ||
tm.assert_series_equal(result, expected) | ||
|
||
def test_getitem_partial_int(self): | ||
# GH 12416 | ||
# with single item | ||
|
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.
can u add some comments here