Skip to content

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

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 Dec 20, 2014 · 1 comment
Closed

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

shoyer opened this issue Dec 20, 2014 · 1 comment
Labels
Bug Datetime Datetime data dtype
Milestone

Comments

@shoyer
Copy link
Member

shoyer commented Dec 20, 2014

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.

@shoyer shoyer added Bug Datetime Datetime data dtype labels Dec 20, 2014
@shoyer shoyer added this to the 0.16.0 milestone Dec 20, 2014
@jreback
Copy link
Contributor

jreback commented Dec 20, 2014

this is more of a case of DatetimeIndex should have less code in its new method (and just defer to pd.to_datetime).

@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 6, 2015
@jreback jreback modified the milestones: 0.19.0, Next Major Release Jul 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants