A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/14190 below:

Categorical constructor is not idempotent with datetime with tz · Issue #14190 · pandas-dev/pandas · GitHub

Skip to content Navigation Menu

Saved searches Use saved searches to filter your results more quickly

Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert Additional navigation options

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

Description

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]

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4