-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: astype with timedelta and datetime string (#22100) #22107
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
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8cb0654
BUG: astype with timedelta and datetime string (#22100)
fjdiod 52257e3
fix style
fjdiod 7196cf5
fix test
fjdiod e508d93
fix m8
fjdiod 3a182a3
Merge remote-tracking branch 'upstream/master' into astype-time
7be8de9
add whatsnew entry
21c0520
fix test_astype_nansafe
74e670b
fix datetime64 in astype_nansafe
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
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
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
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.
use is_integer_dtype and also add a comment here (and can remove the existing work around comment)
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.
Ok, but it breaks:
pandas/pandas/tests/reshape/merge/test_merge.py
Lines 531 to 538 in f76a3f3
Because of:
pandas/pandas/core/dtypes/cast.py
Lines 688 to 697 in f76a3f3
Are this necessary? Here timedelta64 are turned to float64.
Should I change the test or this part of
astype_nansafe
?Also, I've notices that conversions like
pd.Series([None, 1, 2]).astype('timedelta64')
do not work now. Should I open a new issue?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.
Might be missing something but shouldn't it not be going down this branch? i.e. isn't the statement
dtype not in [_INT64_DTYPE, _TD_DTYPE]
supposed to be 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.
Is IntNADType handled correctly here?
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.
@WillAyd yah at this point I’m not sure if it’s tangential, but it looks like the TDDTYPE check should go above the (PY3 ...) check in line 688, after which that check is always-true.