Home > other >  New people for help: python for weighted average after how to do
New people for help: python for weighted average after how to do

Time:09-27

Recently are learning python, encountered a problem:

As shown in the above, needs to be grouped, need a weighted average of the composition and weight of the column needs to sum (the sum of weight (*)/sum (weight))
The results are as follows:

Strives for the various gods, how to implement in python?

CodePudding user response:

Excuse me, are you want to use pandas (similar to SQL) or, traveled through the CSV file, according to the result then

CodePudding user response:

Want to solve with pandas,

CodePudding user response:

Has been solved, numpy. Business ()
  • Related