Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
Closed
@jreback

Description

@jreback
Issue body actions

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]

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.