Unique values of two columns for pandas dataframe
You need groupby
+ size
+ Series.reset_index
:
df = df.groupby(['Col1', 'Col2']).size().reset_index(name='Freq')
print (df)
Col1 Col2 Freq
0 1 1 1
1 1 2 3
2 3 4 2
You could try
df.groupby(['Col1', 'Col2']).size()
for a different visual output in comparison to jez's answer, you can extend that solution with
pd.DataFrame(df.groupby(['Col1', 'Col2']).size().rename('Freq'))
gives
Freq
Col1 Col2
1 1 1
2 3
3 4 2