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: conversion from np.datetime64 has odd numpy buglet #3416

Closed
jreback opened this issue Apr 22, 2013 · 1 comment
Closed

BUG: conversion from np.datetime64 has odd numpy buglet #3416

jreback opened this issue Apr 22, 2013 · 1 comment
Assignees
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented Apr 22, 2013

see #3414

The resulting dtype is wrong (should be datetime64[ns]),
and should either raise on dtype='datetime64' or deal with it in Series

In [1]: dates = [
   ...:     np.datetime64(datetime.date(2013, 1, 1)),
   ...:     np.datetime64(datetime.date(2013, 1, 2)),
   ...:     np.datetime64(datetime.date(2013, 1, 3)),
   ...: ]

In [2]: s = pd.Series(dates, dtype='datetime64')

In [3]: s.ix[0] = np.nan

In [4]: print s
0                   NaT
1   2013-01-02 00:00:00
2   2013-01-03 00:00:00
dtype: datetime64[us]

This should force conversion on the np.datetime64 (regardless of there dtype)

In [22]: pd.Series(dates)
Out[22]: 
0    2013-01-01 00:00:00
1    2013-01-02 00:00:00
2    2013-01-03 00:00:00
dtype: object

Clearly incorrect interpret of np.datetime64 dtypes as well (its interpreting them as M8[ns], not converting
to)

In [25]: pd.Series(dates,dtype='M8[ns]')
Out[25]: 
0   1970-01-16 16:56:38.400000
1   1970-01-16 16:58:04.800000
2   1970-01-16 16:59:31.200000
dtype: datetime64[ns]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
1 participant