I have data like this:
Date | Location | Item
-----------------------
1 | x | a
1 | x | b
1 | x | a
2 | b | a
and I'd like to extract unique values of rows and add a column for number of occurence
I tried this command but it failed:
p=df3.groupby(['date', 'location', 'item']).count()
Result=
Date | Location | Item | Occurences
------------------------------------
1 | x | a | 2
1 | x | b | 1
2 | b | a | 1