数据分析(六)

加权平均值

样本:S = [s1, s2, ..., sn]

权重:W = [w1, w2, ..., wn]

加权平均值:a = (s1w1+s2w2+...+snwn)/(w1+w2+...+wn)

np.average(closing_prices, weights=volumes)

猜你喜欢

转载自www.cnblogs.com/maplethefox/p/11458496.html
今日推荐