pandas weighted average groupby

Solutions on MaxInterview for pandas weighted average groupby by the best coders in the world

showing results for - "pandas weighted average groupby"
Lloyd
22 Jun 2017
1(sales["Current_Price"] * sales["Quantity"]).sum() / sales["Quantity"].sum()
2(sales["New_Product_Price"] * sales["Quantity"]).sum() / sales["Quantity"].sum()
3
Simon
14 May 2016
1sales.groupby("Manager").apply(lambda x: np.average(x['New_Product_Price'], weights=x['Quantity']))
2