Skip to content

Bug: Series[category].replace casts incorrectly #26988

Closed
@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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions