Calculate the total number of matches played by teams, When it is present in both the HomeTeam
and AwayTeam
columns using pandas/pyspark.
I thought of using join. First, I groupby()
the HomeTeam and get the result of the number of matches played by HomeTeam
and same with AwayTeam
. And then join them based on the team name.
I have attached the dataframe:
Is there any better way to do it