Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas weighted average groupby

sales.groupby("Manager").apply(lambda x: np.average(x['New_Product_Price'], weights=x['Quantity']))
Source by pbpython.com #
 
PREVIOUS NEXT
Tagged: #pandas #weighted #average #groupby
ADD COMMENT
Topic
Name
1+1 =