-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG to_timedelta was raising ValueError w pd.NA #53022
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
Conversation
I think this is partially fixing #40566 - the first 3 cases on the issue description are no longer failing. Edit: |
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.
nice! looks like this is close, just have a minor comment and a question
@@ -471,7 +471,7 @@ class TestAstypeString: | |||
def test_astype_string_to_extension_dtype_roundtrip( | |||
self, data, dtype, request, nullable_string_dtype | |||
): | |||
if dtype == "boolean" or (dtype == "timedelta64[ns]" and NaT in data): |
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.
just for my understanding, why did this one change?
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.
ah it's because
ser.astype(nullable_string_dtype)
introduces '<NA>'
, and then .astype('timedelta64[ns]')
couldn't handle that (but it can after this PR!)
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.
looks good to me, thanks @DeaMariaLeon !
Leaving open til tomorrow in case anyone else has comments, then will merge
@@ -471,7 +471,7 @@ class TestAstypeString: | |||
def test_astype_string_to_extension_dtype_roundtrip( | |||
self, data, dtype, request, nullable_string_dtype | |||
): | |||
if dtype == "boolean" or (dtype == "timedelta64[ns]" and NaT in data): |
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.
ah it's because
ser.astype(nullable_string_dtype)
introduces '<NA>'
, and then .astype('timedelta64[ns]')
couldn't handle that (but it can after this PR!)
Thanks @MarcoGorelli for reviewing & merging. I even got a cat! :-) |
Thanks @DeaMariaLeon |
Thank you for merging @mroeschke |
* BUG fixing timedelta * BUG timedelta raising w pd.NA * BUG removed not needed fail on test .. ? * BUG Parametrised test
* BUG fixing timedelta * BUG timedelta raising w pd.NA * BUG removed not needed fail on test .. ? * BUG Parametrised test
* BUG fixing timedelta * BUG timedelta raising w pd.NA * BUG removed not needed fail on test .. ? * BUG Parametrised test
i think this fixed #38509 too! |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.