I have a dataframe :
ID CATEGORY AMOUNT
1 T1 1000
2 T2 1500
3 T3 2000
4 T4 3000
5 T1 2000
6 T2 2500
7 T3 7000
8 T4 4000
9 T1 1000
10 T2 1500
11 T3 2000
12 T4 3000
I want to groupby
category and then get the mode of each category:
T1 1000
T2 1500
All the way to T4. When I run the below python code I get an error:
df['AMOUNT'].groupby(df['CATEGORY']).mode()
I get the below error
AttributeError: Cannot access callable attribute 'mode' of 'SeriesGroupBy' objects, try using the 'apply' method