Say I have a dataset like
z = pd.DataFrame({'match': [1,1,2,2,3,3,4,4],
'group': [0,1,1,2,0,2,1,2],
'win': [0,1,1,0,0,1,0,1]})
Notice, for example, that group "1" and "2" are paired up twice (in match 2 and 4), and in this matchup, group 2 has a 50% win rate.
I want an array that shows the avg win rate of each group pairing, something like
0 1 2
0 - 0.0 0.0
1 1.0 - 0.5
2 1.0 0.5 -
but I have no idea how to get there with standard groupby
and agg
methods.