Reputation: 37
Im stuck tryin to index after a grouby and sum here is the code and the result
Count.groupby(Count.MesEntrada % 100)['Hipoges Value Total'].sum()
MesEntrada
1 1.012410e+07
2 2.585200e+07
3 8.185106e+07
4 9.896478e+06
5 3.551263e+07
6 3.187036e+07
7 1.233078e+07
8 1.115747e+07
9 7.350286e+06
10 1.203782e+07
Now im tryin to index so once i export it the data looks grouped by the months like the df(Count)
but im writing this code and doesnt works
Count1= Count.to_frame(name = 'Hipoges Value Total').reset_index()
Upvotes: 1
Views: 34
Reputation: 37
This would be the correct way to do what i need it.
Count1 = Count.groupby(['MesEntrada'],as_index=False)['Hipoges Value Total'].sum()
Count1
MesEntrada Hipoges Value Total
0 1 1.012410e+07
1 2 2.585200e+07
2 3 8.185106e+07
3 4 9.896478e+06
4 5 3.551263e+07
5 6 3.187036e+07
6 7 1.233078e+07
7 8 1.115747e+07
8 9 7.350286e+06
9 10 1.203782e+07
Upvotes: 2