-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
BUG: TimedeltaIndex raising ValueError when slice indexing (#16637) #16638
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
Merged
+33
−5
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6d23625
BUG: TimedeltaIndex raising ValueError when slice indexing (#16637)
6309877
v0.20.2 is already released
094d25a
Fixed unit tests.
4a0b379
This test would fail on 32 bits.
d842230
Changes based on review comments
00675c0
* Fixed bug on windows with int32/int64 confusion
12ecdc4
Final change based on @jreback comments
dc8cb7a
Using pytest parametrize as per @jreback suggestion.
358bfca
Unneeded try except.
186549a
Corrections from @jreback comments
7df27da
Fixed lint issue
b38d6ba
Merge branch 'master' into bug_delta_time
TomAugspurger b5f43a0
Update v0.20.3.txt
TomAugspurger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Changes based on review comments
* Fixed bug on windows with int32/int64 confusion * Added unit_test to is_timedelta64_dtype when a string is passed * Changed unit_test name from `test_slice_indexing` to `test_list_like_indexing`
- Loading branch information
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,13 +13,14 @@ def test_boolean_indexing(self): | |
[0, 1, 2, 10, 4, 5, 6, 7, 8, 9], | ||
[10, 10, 10, 3, 4, 5, 6, 7, 8, 9]] | ||
for cond, data in zip(conditions, expected_data): | ||
result = df.assign(x=df.mask(cond, 10).astype(df['x'].dtype)) | ||
result = df.assign(x=df.mask(cond, 10).astype('int64')) | ||
expected = pd.DataFrame(data, | ||
index=pd.to_timedelta(range(10), unit='s'), | ||
columns=['x']) | ||
columns=['x'], | ||
dtype='int64') | ||
tm.assert_frame_equal(expected, result) | ||
|
||
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. just make sure test is near other slicing testsing (may not actually be many). |
||
def test_slice_indexing(self): | ||
def test_list_like_indexing(self): | ||
# GH 16637 | ||
df = pd.DataFrame({'x': range(10)}) | ||
df.index = pd.to_timedelta(range(10), unit='s') | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
didn't you have 2 cases that trigger the exception? if so pls add the other one.
Uh oh!
There was an error while loading. Please reload this page.
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.
Not that I am aware of. There is a separate issue I think were isnull would trigger an exception in the get_loc function. I don't see how that condition could be hit in the future.