Pandas groupby each group and divide each row by its sum

后端 未结 0 1436
予麋鹿
予麋鹿 2021-01-29 10:03

I have a df

df = pd.DataFrame({\'group\':[\'a\',\'a\',\'b\',\'b\',\'c\',\'c\',\'c\'], \'score\':[1,2,3,4,5,6,7]})

group score
0   a   1
1   a   2
2   b   3
3   b         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题