df = pd.DataFrame({'col1': [1,2,4,3], 'col2': [2,1,3,4]})
col1 col2
0 1 2
1 2 1
2 4 3
3 3 4
Desired outcome
col1 col2 count
0 1 2 2
1 4 3 2
I tried
(df.groupby(['team1','team2']).size()
.sort_values(ascending=False)
.reset_index(name='Count')
)
but this is not giving me unique combination