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.
Asked
Active
Viewed 56 times
0

Jrblack
- 39
- 5
-
Can you post your data in a reproducible format rather than an image, and give the specific of example of what your desired output is? There is a great reference post on [How to make good, reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) – scotscotmcc Nov 28 '21 at 02:49
1 Answers
1
You can check with mean
: will return the total win percentage
df.groupby('top')['result'].mean()

BENY
- 317,841
- 20
- 164
- 234