mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-15 08:46:56 +08:00
fix bug (#950)
fix bug in elif isinstance(self.N, float) and 0 < self.N < 1:
This commit is contained in:
@@ -726,7 +726,7 @@ class Rolling(ExpressionOps):
|
|||||||
# isnull = series.isnull() # NOTE: isnull = NaN, inf is not null
|
# isnull = series.isnull() # NOTE: isnull = NaN, inf is not null
|
||||||
if isinstance(self.N, int) and self.N == 0:
|
if isinstance(self.N, int) and self.N == 0:
|
||||||
series = getattr(series.expanding(min_periods=1), self.func)()
|
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()
|
series = series.ewm(alpha=self.N, min_periods=1).mean()
|
||||||
else:
|
else:
|
||||||
series = getattr(series.rolling(self.N, min_periods=1), self.func)()
|
series = getattr(series.rolling(self.N, min_periods=1), self.func)()
|
||||||
|
|||||||
Reference in New Issue
Block a user