-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
BugMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateTimezonesTimezone data dtypeTimezone data dtype
Milestone
Description
Not sure if this is intentional / known.
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.
Metadata
Metadata
Assignees
Labels
BugMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateTimezonesTimezone data dtypeTimezone data dtype