You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [58]: tz = pd.DatetimeIndex(start='2010-01-01', periods=10, freq='d', tz='US/Central')
In [59]: df = pd.DataFrame(np.random.randn(10, 2), columns=['A', 'B'])
In [60]: df['time'] = tz
In [62]: df.dtypes
Out[62]:
A float64
B float64
time object
dtype: object
In [63]: df.fillna(0).dtypes
Out[63]:
A float64
B float64
time datetime64[ns]
dtype: object
Notice that the dtype of the time column changes from object (column of Timestamps) to datetime64[ns].
I think what's happening is the timestamps are being downcast:
In [64]: df.fillna(0, downcast=False).dtypes
Out[64]:
A float64
B float64
time object
dtype: object
The reason I worry about this as the default is because the timestamp information is lost.
The text was updated successfully, but these errors were encountered:
Not sure if this is intentional / known.
Notice that the dtype of the
time
column changes fromobject
(column ofTimestamps
) todatetime64[ns]
.I think what's happening is the timestamps are being downcast:
The reason I worry about this as the default is because the timestamp information is lost.
The text was updated successfully, but these errors were encountered: