1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-07 04:50:56 +08:00

Update Sign in ops.py

This commit is contained in:
Yifan Deng (FA Talent)
2020-12-14 16:09:21 +08:00
committed by you-n-g
parent c217e7c479
commit 6b8824dd29

View File

@@ -144,7 +144,11 @@ class Sign(ElemOperator):
super(Sign, self).__init__(feature, "sign")
def _load_internal(self, instrument, start_index, end_index, freq):
"""
To avoid error raised by bool type input, we transform the data into float32.
"""
series = self.feature.load(instrument, start_index, end_index, freq)
# TODO: More precision types should be configurable
series = series.astype(np.float32)
return getattr(np, self.func)(series)