Bug: Series[category].replace casts incorrectly · Issue #26988 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@jbrockmendel

Description

@jbrockmendel

dti = pd.date_range('2016-01-01', periods=3, tz='US/Pacific')
ser = pd.Series(dti)
cat = ser.astype('category')

>>> cat
0   2016-01-01 00:00:00-08:00
1   2016-01-02 00:00:00-08:00
2   2016-01-03 00:00:00-08:00
dtype: category
Categories (3, datetime64[ns, US/Pacific]): [2016-01-01 00:00:00-08:00, 2016-01-02 00:00:00-08:00,
                                             2016-01-03 00:00:00-08:00]

>>> cat.replace(cat[1], 'foo')
0    1451635200000000000
1    1451721600000000000
2    1451808000000000000
dtype: int64