0

Lets say i have following dataframe df:

col1    col2 
-------------
apple   apple
melon   apple
apple   apple
pear    melon

Now, how do i count all combinations and write it into a new column? Like this.

col1    col2   amount
---------------------
apple   apple    2
melon   apple    1
pear    melon    1
kxell2001
  • 131
  • 1
  • 1
  • 9

0 Answers0