Posted By

adkatrit on 02/11/11


Tagged

weighted mean


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

adkatrit


Weighted Mean


 / Published in: Python
 

  1. def weightedmean(x,w):
  2. num=sum([x[i]*w[i] for i in range(len(w))])
  3. den=sum([w[i] for i in range(len(w))])
  4. return num/den

Report this snippet  

You need to login to post a comment.