bug in Series.replace with timezone-aware datetime columns · Issue #11792 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@multiloc

Description

@multiloc

Seeing the following behavior in 0.17.1 with the patch from #11715 applied (would raise without the patch):

In [29]: ser = pd.Series([pd.NaT, pd.Timestamp('2015/01/01', tz='UTC')])

works

In [30]: ser.replace(pd.NaT, pd.Timestamp.min) Out[30]: 0 1677-09-22 00:12:43.145225 1 2015-01-01 00:00:00+00:00 dtype: object

doesn't work

In [31]: ser.replace([np.nan, pd.NaT], pd.Timestamp.min) Out[31]: 0 NaT 1 2015-01-01 00:00:00+00:00 dtype: datetime64[ns, UTC]

works without timezone-aware datetimes

In [32]: ser = pd.Series([pd.NaT, pd.Timestamp('2015/01/01')]) In [33]: ser.replace([np.nan, pd.NaT], pd.Timestamp.min) Out[33]: 0 1677-09-22 00:12:43.145225 1 2015-01-01 00:00:00.000000 dtype: datetime64[ns]