Skip to content

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

Closed
@shoyer

Description

@shoyer
Member

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.

Activity

jreback

jreback commented on Jan 27, 2019

@jreback
Contributor

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

shoyer

shoyer commented on Jan 27, 2019

@shoyer
MemberAuthor

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

jreback commented on Jan 27, 2019

@jreback
Contributor

yes there is an issue about this

added
TimedeltaTimedelta data type
RegressionFunctionality that used to work in a prior pandas version
and removed on Jan 27, 2019
gfyoung

gfyoung commented on Jan 27, 2019

@gfyoung
Member

xref #24416

added this to the 0.24.1 milestone on Jan 27, 2019
jbrockmendel

jbrockmendel commented on Jan 27, 2019

@jbrockmendel
Member

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

jbrockmendel

jbrockmendel commented on Dec 10, 2019

@jbrockmendel
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    RegressionFunctionality that used to work in a prior pandas versionTimedeltaTimedelta data type

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      Participants

      @jreback@shoyer@jbrockmendel@gfyoung

      Issue actions

        BUG: to_timedelta('NaT', box=False) returns datetime64('NaT') · Issue #24957 · pandas-dev/pandas