pd.crosstab(df.column_1, df.column_2)
# Solution 1 df_solution = df.pivot_table(index=['Column_1', 'Column_2'], aggfunc='size') # Solution 2 pd.crosstab(df.Column_1, df.Column_2)