-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Fixes for #16896(TimedeltaIndex indexing regression for strings) #16907
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 6 commits
e163de1
2be2156
f65c018
21b5bd2
dcb274d
7d89c19
3d36695
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 |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
|
||
|
||
class TestTimedeltaIndexing(object): | ||
|
||
def test_boolean_indexing(self): | ||
# GH 14946 | ||
df = pd.DataFrame({'x': range(10)}) | ||
|
@@ -40,3 +39,13 @@ def test_list_like_indexing(self, indexer, expected): | |
dtype="int64") | ||
|
||
tm.assert_frame_equal(expected, df) | ||
|
||
def test_string_indexing(self): | ||
# GH 16896 | ||
df = pd.DataFrame({'x': range(3)}, | ||
index=pd.to_timedelta(range(3), unit='days')) | ||
expected = df.iloc[0] | ||
sliced = df.loc['0 days'] | ||
tm.assert_series_equal(sliced, expected) | ||
|
||
assert df.index.get_loc('0 days') == 0 | ||
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. the .get_loc tests are already in you can add some additional tests in 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. There is a check in test_get_loc This line will generate a ValueError in '0 days' generates a TypeError instead. |
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.
silly but can you group all of the assert not ones together (IIRC pattern is to have them first)