diff --git a/qlib/data/ops.py b/qlib/data/ops.py index d9a2ffbb3e..671948d98c 100644 --- a/qlib/data/ops.py +++ b/qlib/data/ops.py @@ -1337,7 +1337,7 @@ def _load_internal(self, instrument, start_index, end_index, *args): def weighted_mean(x): w = np.arange(len(x)) + 1 w = w / w.sum() - return np.nanmean(w * x) + return np.nansum(w * x) if self.N == 0: series = series.expanding(min_periods=1).apply(weighted_mean, raw=True)