diff --git a/qlib/data/dataset/loader.py b/qlib/data/dataset/loader.py index 2094c4514..73538703f 100644 --- a/qlib/data/dataset/loader.py +++ b/qlib/data/dataset/loader.py @@ -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): diff --git a/qlib/data/ops.py b/qlib/data/ops.py index dfbe013f7..3e83e6829 100644 --- a/qlib/data/ops.py +++ b/qlib/data/ops.py @@ -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")