I have two columns like this.
name length
0 Pk 78
2 Pk 59
4 Pk 283
6 Ser 100
7 Ig_2 79
8 Ig_2 77
9 Ser 369
I want to calculate the average of each name. For example
Pk - 140
ser -234.5
Ig_2 -78
How can i do this with python panda.
I was trying this.
df.groupby(level=0).mean()
but didn't work. Is there anyway to use rolling() function for this?