0

I would like to create a column showing the order of the number of times the number has appeared.

To give you an example

cell    order
012       1  
012       2
012       3
013       1
014       1
012       4
014       2
015       1
014       3
015       2
014       4

I know I can return the total number of appearances using count or size:

df.groupby('cell')['cell'].transform('count')

but this returns total number of times each cell number appears

Emm
  • 2,367
  • 3
  • 24
  • 50

0 Answers0