pandas group by and aggregate one column code example Example: python - gropuby based on 2 variabels df.groupby(['col5', 'col2']).size()