I am a newbie to Python and pandas and learning the same. I have basic question for pandas dataframe related to groupby. I have a dataframe and from that I want to have some calculations as below:
SH TH QH RH
S1 B 10 5
S2 B 12 8
S1 B 5 8
S1 S 5 10
S1 S 3 12
And I want something like this as intermediate:
SH TH QH RH
S1 B 15 6
S1 S 8 10.75
S2 B 12 8
And final result as below:
SH TH QH RH
S1 B 7 6
S2 B 12 8
I want to know how best I can do it in python pandas way of doing it.
Thanks Nand