Closed
Description
From SO: http://stackoverflow.com/questions/33775560/how-to-group-categorical-values-in-pandas
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)