Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas weighted average groupby

(sales["Current_Price"] * sales["Quantity"]).sum() / sales["Quantity"].sum()
(sales["New_Product_Price"] * sales["Quantity"]).sum() / sales["Quantity"].sum()
Source by pbpython.com #
 
PREVIOUS NEXT
Tagged: #pandas #weighted #average #groupby
ADD COMMENT
Topic
Name
9+5 =