ops计算代码中的下面这个函数不对。应该使用np.nansum(w*x) def weighted_mean(x): w = np.arange(len(x)) + 1 w = w / w.sum() return np.nanmean(w * x)