From 9e3d0249f737e77a625059afe6a633f4615a8ea4 Mon Sep 17 00:00:00 2001 From: Chao Wang Date: Sun, 6 Mar 2022 10:42:31 -0500 Subject: [PATCH] fix bug (#950) fix bug in elif isinstance(self.N, float) and 0 < self.N < 1: --- qlib/data/ops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qlib/data/ops.py b/qlib/data/ops.py index 555a29ba4..a0a066817 100644 --- a/qlib/data/ops.py +++ b/qlib/data/ops.py @@ -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)()