I have a dataframe of matches of League of Legends with the champions played and which team won, and I would like to get a champion count of matches played, and divide it by how many they won to get the win ratio. I can get the amount of times the champions was played with value_count(), but I can't figure out how to sum the result columns depending on the champion played column. The dataframe looks like this.
CodePudding user response:
You can check with mean
: will return the total win percentage
df.groupby('top')['result'].mean()