Skip to content

Commit 026acd0

Browse files
authored
fall back error (microsoft#875)
1 parent c98a86e commit 026acd0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

qlib/data/dataset/loader.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ class StaticDataLoader(DataLoader, Serializable):
226226

227227
include_attr = ["_config"]
228228

229-
def __init__(self, config: Union[dict, str], join="outer"):
229+
def __init__(self, config: Union[dict, str, pd.DataFrame], join="outer"):
230230
"""
231231
Parameters
232232
----------
@@ -269,6 +269,8 @@ def _maybe_load_raw_data(self):
269269
elif isinstance(self._config, (str, Path)):
270270
with Path(self._config).open("rb") as f:
271271
self._data = pickle.load(f)
272+
elif isinstance(self._config, pd.DataFrame):
273+
self._data = self._config
272274

273275

274276
class DataLoaderDH(DataLoader):

qlib/data/ops.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
"#### Do not import qlib package in the repository directory in case of importing qlib from . without compiling #####"
2828
)
2929
raise
30+
except ValueError as e:
31+
print("!!!!!!!! A error occurs when importing operators implemented based on Cython.!!!!!!!!")
32+
print("!!!!!!!! They will be disabled. Please Upgrade your numpy to enable them !!!!!!!!")
33+
# We catch this error because some platform can't upgrade there package (e.g. Kaggle)
34+
# https://www.kaggle.com/general/293387
35+
# https://www.kaggle.com/product-feedback/98562
3036

3137

3238
np.seterr(invalid="ignore")

0 commit comments

Comments
 (0)