I have a dataframe like
import pandas as pd
A = ['x' , 'x', 'y', 'y', 'y']
B = [1, 3, 2, 1, 4]
C = [2, 3, 7, 2, 1]
df = pd.DataFrame({'A' : A, 'B' : B, 'C' : C })
df
and unfortunately I couldn't do this calculation on each group after df.groupby(['A']): multiply B elementwise with C elements and sum them and divide this by sum of elements of B and so heve the following:
df1 = pd.DataFrame({'A' : ['x', 'y'], '(B*C)/B' : [(1*2 + 3*3)/(1+3) , (2*7+1*2+4*1)/(2+1+4)]})
df1