I have a data frame df and I use several columns from it to groupby:
df
groupby
df[\'col1\',\'col2\',\'col3\',\'col4\'].groupby([\'col1\',\'co
We can easily do it by using groupby and count. But, we should remember to use reset_index().
df[['col1','col2','col3','col4']].groupby(['col1','col2']).count().\ reset_index()