BUG: Series creation with datetime64 with non-ns unit as object dtype by sinhrks · Pull Request #13876 · pandas-dev/pandas (original) (raw)

found a bug related to datetime64 with non-ns unit.

# OK
pd.Series(np.array([np.datetime64('2011-01-01')]))
#0   2011-01-01
# dtype: datetime64[ns]

# OK
pd.Series([np.datetime64('2011-01-01')], dtype=object)
#0    2011-01-01
# dtype: object

# NG
pd.Series(np.array([np.datetime64('2011-01-01')]), dtype=object)
#0    1970-01-01 00:00:00.000014
# dtype: object

# OK
pd.Series(np.array([np.datetime64('2011-01-01', 'ns')]), dtype=object)
#0    2011-01-01 00:00:00
# dtype: object