Groupe par Count DataFrame
df.groupby(['col1', 'col2']).size().reset_index(name='counts')
Crazy Caterpillar
df.groupby(['col1', 'col2']).size().reset_index(name='counts')
In [4]: df.groupby(['col1', 'col2']).size().reset_index(name='counts')
Out[4]:
col1 col2 counts
0 A B 4
1 C D 3
2 E F 2
3 G H 1
df.groupby(['col1','col2']).size()
raw_dataset.groupby('machineFailure',as_index=False).agg({"PID": "count"})
df = pd.DataFrame({'a':list('abssbab')})
df.groupby('a').count()
df[['col1', 'col2', 'col3', 'col4']].groupby(['col1', 'col2']).agg(['mean', 'count'])