I have a pandas dataframe containing sports matches:
Winner Loser
A B
B A
A C
i want to have win-loss statistics for each player (i.e. A, B, and C). so for A the result should be 2-1. for B it should be 1-1 and for C it should be 0-1.
i know how to calculate this via iterating line-by-line over the dataframe with:
for index, match in df.iterrows():
//code for calculating win-loss here
but I am sure that there is a more pythonic/pandas-ish way to do this? any hints on this are appreciated.