0

With this:

df = pd.DataFrame({'players.name': ['John', 'Will' ,'John', 'Jim', 'Tim', 'John', 'Will', 'Tim'],
                    'players.diff': [0,0, 0, 0, 0, 0, 0, 0]})

But 'players.name' values are repeated many times, and I need to count the number os times each unique name appears, adding a column 'count', with this value, ending up with:

  players.name  players.diff  counts
0         John             0       3
1         Will             0       2
2         John             0       0
3          Jim             0       1
4          Tim             0       2
5         John             0       0
6         Will             0       2
7          Tim             0       2

How do I do this?

8-Bit Borges
  • 9,643
  • 29
  • 101
  • 198

0 Answers0