I have a df:
Type price stock
a 2 2
b 4 1
b 3 3
a 1 2
a 3 1
The result I would like to get is:
Type price*stock
a 2*2+1*2+3*1 = 9
b 4*1+3*3 = 13
I can easily do it in Excel, but how about in Pandas? I have tried groupby function but still fails:(
Also: