Skip to content

BUG: datetime64[us] arrays with NaT cannot be cast to DatetimeIndex #9114

Closed
@shoyer

Description

@shoyer
In [11]: t = pd.to_datetime(['2000-01-01T00:00', 'NaT']).values.astype('datetime64[us]')

In [12]: pd.DatetimeIndex(t)
OutOfBoundsDatetime: Out of bounds nanosecond timestamp: 294247-01-09 19:59:05

In [13]: pd.to_datetime(t)
Out[13]:
<class 'pandas.tseries.index.DatetimeIndex'>
[2000-01-01, NaT]
Length: 2, Freq: None, Timezone: None

The second line should give the same result as the last one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions