Skip to content
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

BUG: Series[td64].astype("string").astype("timedelta64[ns]") raises #38509

Closed
jbrockmendel opened this issue Dec 15, 2020 · 1 comment
Closed
Labels
Astype Bug Dtype Conversions Unexpected or buggy dtype conversions Strings String extension data type and string data Timedelta Timedelta data type

Comments

@jbrockmendel
Copy link
Member

tdi = pd.timedelta_range("1 Day", periods=3)

ser = pd.Series(tdi)

>>> ser.astype("string")
0    1 days
1    2 days
2    3 days
dtype: string

>>> ser.astype("string").astype(ser.dtype)
[...]
ValueError: Could not convert object to NumPy timedelta

We have a round-trip test for string -> dt64 in test_astype_roundtrip, should amend that to do td64 when this is fixed

@jbrockmendel
Copy link
Member Author

Closed by #53022. i've added a test to my next Assorted branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Astype Bug Dtype Conversions Unexpected or buggy dtype conversions Strings String extension data type and string data Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants