-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
BugCategoricalCategorical Data TypeCategorical Data TypeGroupbyRegressionFunctionality that used to work in a prior pandas versionFunctionality that used to work in a prior pandas version
Description
import pandas as pd
df = pd.DataFrame()
df['A'] = ['C1', 'C1', 'C2', 'C2', 'C3', 'C3']
df['B'] = [1,2,3,4,5,6]
df['A'] = df.loc[:,'A'].astype('category')
df2 = df[0:3]
result = df2.groupby(by='A')['B'].nunique()
This worked in 0.16.2, but is broken in 0.17.0 (it gives ValueError: Wrong number of items passed 2, placement implies 3)
It is related with the fact that not all categories are present in the actual values (due to the slicing).
Probably related with new nunique implementation in 0.16.2 (#10894, #11079)
Metadata
Metadata
Assignees
Labels
BugCategoricalCategorical Data TypeCategorical Data TypeGroupbyRegressionFunctionality that used to work in a prior pandas versionFunctionality that used to work in a prior pandas version