I have a DataFrame that looks like this:
home_team away_team score home_goals away_goals winner
1 Arsenal Chelsea 3-0 3 0 Arsenal
2 ManCity Arsenal 1-1 1 1 draw
3 Chelsea Arsenal 2-1 2 1 Chelsea
4 Arsenal Chelsea 5-5 5 5 draw
5 Arsenal ManCity 1-2 1 2 ManCity
My question is: how do I calculate the win-draw-loss/head-to-head record for Arsenal vs. another team?
A potential desired outcome could look like the following:
team opponent games_played wins draws losses goals_scored goals_conceded
1 Arsenal Chelsea 3 1 1 1 9 7
2 Arsenal ManCity 2 0 1 1 2 3
Any help is greatly appreciated. Note, the dataframe is not real (in case any Premier League experts are lurking)!