Weigted Average in Pandas
g = df.groupby('Date')
df.value / g.value.transform("sum") * df.wt
devil-cyber
g = df.groupby('Date')
df.value / g.value.transform("sum") * df.wt
In [11]: g = df.groupby('Date')
In [12]: df.value / g.value.transform("sum") * df.wt
Out[12]:
0 0.125000
1 0.250000
2 0.416667
3 0.277778
4 0.444444
dtype: float64