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
If Categorical has datetime-like categories, groupby fails if sort=False is specified.
# OK
df.groupby(pd.Categorical(pd.DatetimeIndex(['2011', '2012', '2011', '2012']))).groups
# {numpy.datetime64('2011-01-01T09:00:00.000000000+0900'): [0, 2],
# numpy.datetime64('2012-01-01T09:00:00.000000000+0900'): [1, 3]}
# NG
df.groupby(pd.Categorical(pd.DatetimeIndex(['2011', '2012', '2011', '2012'])), sort=False).groups
# ValueError: items in new_categories are not the same as in old categories
The text was updated successfully, but these errors were encountered:
Related to #10501, but not the same.
groupby
can acceptCategorical
andsort
keyword.If
Categorical
has datetime-like categories, groupby fails ifsort=False
is specified.The text was updated successfully, but these errors were encountered: