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

fall back error (#875)

This commit is contained in:
you-n-g
2022-01-20 01:39:24 +08:00
committed by GitHub
parent 54344c4426
commit 2c5a4691f3
2 changed files with 9 additions and 1 deletions

View File

@@ -226,7 +226,7 @@ class StaticDataLoader(DataLoader, Serializable):
include_attr = ["_config"]
def __init__(self, config: Union[dict, str], join="outer"):
def __init__(self, config: Union[dict, str, pd.DataFrame], join="outer"):
"""
Parameters
----------
@@ -269,6 +269,8 @@ class StaticDataLoader(DataLoader, Serializable):
elif isinstance(self._config, (str, Path)):
with Path(self._config).open("rb") as f:
self._data = pickle.load(f)
elif isinstance(self._config, pd.DataFrame):
self._data = self._config
class DataLoaderDH(DataLoader):

View File

@@ -27,6 +27,12 @@ except ImportError:
"#### Do not import qlib package in the repository directory in case of importing qlib from . without compiling #####"
)
raise
except ValueError as e:
print("!!!!!!!! A error occurs when importing operators implemented based on Cython.!!!!!!!!")
print("!!!!!!!! They will be disabled. Please Upgrade your numpy to enable them !!!!!!!!")
# We catch this error because some platform can't upgrade there package (e.g. Kaggle)
# https://www.kaggle.com/general/293387
# https://www.kaggle.com/product-feedback/98562
np.seterr(invalid="ignore")