-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Bug fix - Astype Timedelta64[ns] fails when np.nan is included #45965
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 5 commits
8758f39
2af174c
55e63f5
68ce0e9
c42d62f
3c7ce1f
9050927
72ca5e2
0fda4eb
7576a2b
3f62d8c
16c46ef
0a99806
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 |
---|---|---|
|
@@ -482,3 +482,10 @@ def test_getitem_str_second_with_datetimeindex(): | |
msg = r"Timestamp\('2012-01-02 18:01:02-0600', tz='US/Central', freq='S'\)" | ||
with pytest.raises(KeyError, match=msg): | ||
df[df.index[2]] | ||
|
||
|
||
def test_astype_timedelta64_with_np_nan(): | ||
# GH45798 | ||
result = Series([1, np.nan]).astype("timedelta64[ns]") | ||
expected = Series([1, pd.NaT]).astype("timedelta64[ns]") | ||
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. to be explictily construct here the expected 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. Hi I do not understand. Can please give more details? Thank. 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. if the method being tested is Series.astype, then the test belongs in tests.series.methods.test_astype |
||
tm.assert_series_equal(result, expected) |
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.
these are astype tests, pls move them.