python create frequency table between two columns

Solutions on MaxInterview for python create frequency table between two columns by the best coders in the world

showing results for - "python create frequency table between two columns"
Lamia
07 Oct 2017
1pd.crosstab(df.column_1, df.column_2)
Matilda
07 Jun 2020
1# Solution 1
2df_solution = df.pivot_table(index=['Column_1', 'Column_2'], aggfunc='size')
3
4# Solution 2
5pd.crosstab(df.Column_1, df.Column_2)