1In [12]: df.groupby(["item", "color"])["id"].count().reset_index(name="count")
2Out[12]:
3 item color count
40 car black 2
51 truck blue 1
62 truck red 2
1df[['col1', 'col2', 'col3', 'col4']].groupby(['col1', 'col2']).agg(['mean', 'count'])
2