0

I can't seem to find a solution to my problem. I have used groupby and value_count to get all the results for each team but I can not find a way to split the column to make three new ones for (H = Win, D = Draw, A= Loss) the new column names. I don't know if I am just serching for the wrong thing or the way I have it now will not work.

matchdata.groupby("HomeTeam")["FullTimeResult"].value_counts()

Results in:

HomeTeam     FullTimeResult
Arsenal      H                 10
             D                  6
             A                  3
Aston Villa  A                  9
             H                  7
             D                  3

Wanted output

HomeTeam      Win     Draw     Loss   
Arsenal        10      6         3
AstonVilla     7       3         9
eg...
Josh Adams
  • 2,113
  • 2
  • 13
  • 25
AndroidDev
  • 67
  • 6

0 Answers0