1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-13 07:46:53 +08:00

more general exception

This commit is contained in:
lzh222333
2021-06-28 05:23:45 +00:00
committed by you-n-g
parent d96f7a67c6
commit 0b83fb3564
4 changed files with 26 additions and 29 deletions

View File

@@ -12,7 +12,7 @@ from typing import Tuple, Union
from qlib.data import D
from qlib.data import filter as filter_module
from qlib.data.filter import BaseDFilter
from qlib.utils import load_dataset, init_instance_by_config
from qlib.utils import load_dataset, init_instance_by_config, time_to_slc_point
from qlib.log import get_module_logger
@@ -208,10 +208,8 @@ class StaticDataLoader(DataLoader):
if start_time is None and end_time is None:
return df # NOTE: avoid copy by loc
# pd.Timestamp(None) == NaT, use NaT as index can not fetch correct thing, so do not change None.
if start_time is not None:
start_time = pd.Timestamp(start_time)
if end_time is not None:
end_time = pd.Timestamp(end_time)
start_time = time_to_slc_point(start_time)
end_time = time_to_slc_point(end_time)
return df.loc[start_time:end_time]
def _maybe_load_raw_data(self):