I have following pandas dataframe
ID Quantity Key Product Code decant
0 10 12 HS MT 123
1 13 13 HS LT 124
2 15 13 HS LT 124
3 10 14 MS PQ 145
4 50 15 MS PQ 146
My desired dataframe would be
ID Quantity Key Product Code decant
0 10 12 HS MT 123
1 28 13 HS LT 124
2 10 14 MS PQ 145
3 50 15 MS PQ 146
I want add Quantity where Key is duplicated. I know we can do a groupby and add. But is there any simpler way to do it with numpy? Because I have other columns as well,so groupby will not be a suitable solution