Skip to content

BUG: to_timedelta('NaT', box=False) returns datetime64('NaT') #24957

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
shoyer opened this issue Jan 27, 2019 · 6 comments · Fixed by #24961
Closed

BUG: to_timedelta('NaT', box=False) returns datetime64('NaT') #24957

shoyer opened this issue Jan 27, 2019 · 6 comments · Fixed by #24961
Labels
Regression Functionality that used to work in a prior pandas version Timedelta Timedelta data type
Milestone

Comments

@shoyer
Copy link
Member

shoyer commented Jan 27, 2019

On pandas 0.23 (correct):

In [2]: pd.to_timedelta('NaT', box=False)
Out[2]: numpy.timedelta64('NaT','ns')

But on pandas 0.24:

In [2]: pd.to_timedelta('NaT', box=False)
Out[2]: numpy.datetime64('NaT')

The result is a datetime, not a timedelta.

@jreback
Copy link
Contributor

jreback commented Jan 27, 2019

looks like a bug; note that box parameter is going away in any event

@shoyer
Copy link
Member Author

shoyer commented Jan 27, 2019

looks like a bug; note that box parameter is going away in any event

I hope there's a deprecation cycle planned? (We use box downstream in xarray.)

@jreback
Copy link
Contributor

jreback commented Jan 27, 2019

yes there is an issue about this

@gfyoung gfyoung added Bug Timedelta Timedelta data type Regression Functionality that used to work in a prior pandas version and removed Bug labels Jan 27, 2019
@gfyoung
Copy link
Member

gfyoung commented Jan 27, 2019

xref #24416

@jbrockmendel
Copy link
Member

I’m pretty sure one of my recent PRs broke this, will make a fix shortly.

@jbrockmendel
Copy link
Member

@shoyer we're about to remove the box=False option for to_timedelta in #30177, will this break things for xarray?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Regression Functionality that used to work in a prior pandas version Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants