-
-
Couldn't load subscription status.
- Fork 19.2k
Closed
Labels
Needs TestsUnit test(s) needed to prevent regressionsUnit test(s) needed to prevent regressionsOutput-Formatting__repr__ of pandas objects, to_string__repr__ of pandas objects, to_stringgood first issue
Milestone
Description
Whether np.datetime64('NaT') is printed as NaT or NaN depends on other types present in the column. This is consistent with pd.NaT, whose display also depends on other types. But when all the other scalars are None, pd.NaT and None are both printed as NaT, whereas in a column of np.datetime64('NaT') and None, it depends on the order of the entries (last two lines).
In [44]: pd.DataFrame([[np.datetime64('NaT')], [None]])
Out[44]:
0
0 NaN
1 None
In [45]: pd.DataFrame([[pd.NaT], [None]])
Out[45]:
0
0 NaT
1 NaT
In [46]: pd.DataFrame([[np.datetime64('NaT')], [pd.NaT]])
Out[46]:
0
0 NaT
1 NaT
In [47]: pd.DataFrame([[pd.NaT], [np.datetime64('NaT')]])
Out[47]:
0
0 NaT
1 NaT
In [81]: pd.DataFrame([[None],[np.datetime64('NaT')]])
Out[81]:
0
0 NaT
1 NaT
In [82]: pd.DataFrame([[np.datetime64('NaT')],[None]])
Out[82]:
0
0 NaN
1 None
In [86]: pd.DataFrame([[None],[np.datetime64('NaT')]]).dtypes
Out[86]:
0 datetime64[ns]
dtype: object
In [87]: pd.DataFrame([[np.datetime64('NaT')],[None]]).dtypes
Out[87]:
0 object
dtype: object
Metadata
Metadata
Assignees
Labels
Needs TestsUnit test(s) needed to prevent regressionsUnit test(s) needed to prevent regressionsOutput-Formatting__repr__ of pandas objects, to_string__repr__ of pandas objects, to_stringgood first issue