Skip to content
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

BUG: Categorical constructor is not idempotent with datetime with tz #14190

Closed
chris-b1 opened this issue Sep 8, 2016 · 3 comments
Closed

BUG: Categorical constructor is not idempotent with datetime with tz #14190

chris-b1 opened this issue Sep 8, 2016 · 3 comments
Labels
Categorical Categorical Data Type Dtype Conversions Unexpected or buggy dtype conversions
Milestone

Comments

@chris-b1
Copy link
Contributor

chris-b1 commented Sep 8, 2016

This isn't a huge deal, but popped up adding tests for #14173

Works fine with plain datetimes

In [9]: dti = pd.date_range('2014-01-01', '2014-01-05')

In [10]: pd.Categorical(pd.Categorical(dti))
Out[10]: 
[2014-01-01, 2014-01-02, 2014-01-03, 2014-01-04, 2014-01-05]
Categories (5, datetime64[ns]): [2014-01-01, 2014-01-02, 2014-01-03, 2014-01-04, 2014-01-05]

Does not with a tz

In [11]: dti = pd.date_range('2014-01-01', '2014-01-05', tz='US/Central')

In [12]: pd.Categorical(pd.Categorical(dti))
Out[12]: 
[NaT, NaT, NaT, NaT, NaT]
Categories (5, datetime64[ns, US/Central]): [2014-01-01 00:00:00-06:00, 2014-01-02 00:00:00-06:00, 2014-01-03 00:00:00-06:00, 2014-01-04 00:00:00-06:00, 2014-01-05 00:00:00-06:00]
@rforgione
Copy link
Contributor

I'll take a look at this.

@jreback jreback added Dtype Conversions Unexpected or buggy dtype conversions Categorical Categorical Data Type labels Sep 9, 2016
@jreback
Copy link
Contributor

jreback commented Sep 9, 2016

@rforgione #14191 seems to have this covered

@rforgione
Copy link
Contributor

ah got it, cool -- thanks @jreback .

@jreback jreback added this to the 0.19.0 milestone Sep 9, 2016
@jreback jreback closed this as completed in 939a221 Sep 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Categorical Categorical Data Type Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants