Consider this dataframe
df = pd.DataFrame({'a': [1,2,1,3,4,2], 'c':['dd','ee','dd','as','ae','ee'], 'count':[5,9,1,6,8,3]})
a c count
0 1 dd 5
1 2 ee 9
2 1 dd 1
3 3 as 6
4 4 ae 8
5 2 ee 3
As you can see there are duplicates in column 'a' 1 and 2
are repeated multiple times.
i want to sum the count of such in pandas like in sql we do groupby.
my final df should look like this
a c count
0 1 dd 6
1 2 ee 12
2 3 as 6
3 4 ae 8
i tried by using
df = df.groupby('a')
but it is returning me
<pandas.core.groupby.DataFrameGroupBy object