1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-04 11:30:57 +08:00
fix bug in  elif isinstance(self.N, float) and 0 < self.N < 1:
This commit is contained in:
Chao Wang
2022-03-06 10:42:31 -05:00
committed by GitHub
parent 2ac964c470
commit 9e3d0249f7

View File

@@ -726,7 +726,7 @@ class Rolling(ExpressionOps):
# isnull = series.isnull() # NOTE: isnull = NaN, inf is not null
if isinstance(self.N, int) and self.N == 0:
series = getattr(series.expanding(min_periods=1), self.func)()
elif isinstance(self.N, int) and 0 < self.N < 1:
elif isinstance(self.N, float) and 0 < self.N < 1:
series = series.ewm(alpha=self.N, min_periods=1).mean()
else:
series = getattr(series.rolling(self.N, min_periods=1), self.func)()