SyntaxFix
Write A Post
Hire A Developer
Questions
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()