Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jbrockmendel opened this issue Jun 21, 2019 · 0 comments · Fixed by #27026
Closed

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

jbrockmendel opened this issue Jun 21, 2019 · 0 comments · Fixed by #27026
Labels
Bug Categorical Categorical Data Type Dtype Conversions Unexpected or buggy dtype conversions
Milestone

Comments

@jbrockmendel
Copy link
Member

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

@WillAyd WillAyd added Bug Categorical Categorical Data Type Dtype Conversions Unexpected or buggy dtype conversions labels Jun 22, 2019
@WillAyd WillAyd added this to the Contributions Welcome milestone Jun 22, 2019
@TomAugspurger TomAugspurger modified the milestones: Contributions Welcome, 0.25.0 Jul 8, 2019
@jreback jreback modified the milestones: 0.25.0, Contributions Welcome Jul 9, 2019
@jreback jreback modified the milestones: Contributions Welcome, 1.0 Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Categorical Categorical Data Type Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants