http://stackoverflow.com/questions/17432944/python-pandas-error-when-doing-groupby-counts The below example doesn't make sense, but perhaps the error message could be clearer... ``` df = pd.DataFrame(np.random.randint(0,2,(4,4)), columns=['a', 'b', 'c', 'd']) In [11]: df Out[11]: a b c d gr 0 0 1 1 0 1 1 1 1 1 0 1 2 0 1 1 0 1 3 1 1 0 1 0 In [12]: df.groupby(['b', 'c']).count() Out[12]: a b c d gr b c 1 0 1 1 1 1 1 1 3 3 3 3 3 df['gr'] = df.groupby(['b', 'c']).count() --------------------------------------------------------------------------- ValueError: Buffer dtype mismatch, expected 'Python object' but got 'long' ```