I have a collection of this type with some Premier League matches:
{"HomeTeam": "Chelsea", "HTScore": 2, "FTR": 'D', "AwayTeam": "Everton", "ATScore":2},
{"HomeTeam": "Chelsea", "HTScore": 3, "FTR": 'H', "AwayTeam": "Wolves", "ATScore":1},
{"HomeTeam": "Chelsea", "HTScore": 2, "FTR": 'D', "AwayTeam": "Everton", "ATScore":2},
.....
{"HomeTeam": "Liverpool", "HTScore": 1, "FTR": 'A', "AwayTeam": "Aston Villa", "ATScore":3}
{"HomeTeam": "Liverpool", "HTScore": 6, "FTR": 'H', "AwayTeam": "Chelsea", "ATScore":3}
etc.
where HomeTeam and AwayTeam represent both teams of the match, HTScore represents the HomeTeam score, ATScore represents de AwayTeam score and FTR represents full time result ('A': AwayTeam wins, 'D': Draw, 'H' : Home team wins)
I want to create a table of this type, which in the example set above would be like this
HomeTeam | Number of Victories | Number of Draws | Number of Defeats | Max Goals scored in a Match
---------------------------------------------------------------------------------------
Chelsea | 1 | 2 | 0 | 3
---------------------------------------------------------------------------------------
Liverpool | 1 | 0 | 1 | 6
Is there a way of creating those fields automatically by iterating over the values of FTR? Thank you very much in advance