mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-11 06:46:56 +08:00
fix bug on TRA dataset (#1135)
* fix bug on TRA dataset solve issue "qrun TRA model error (#1062)" * apply black pylint
This commit is contained in:
@@ -203,8 +203,14 @@ class MTSDatasetH(DatasetH):
|
|||||||
|
|
||||||
def _prepare_seg(self, slc, **kwargs):
|
def _prepare_seg(self, slc, **kwargs):
|
||||||
fn = _get_date_parse_fn(self._index[0][1])
|
fn = _get_date_parse_fn(self._index[0][1])
|
||||||
start_date = fn(slc.start)
|
if isinstance(slc, slice):
|
||||||
end_date = fn(slc.stop)
|
start, stop = slc.start, slc.stop
|
||||||
|
elif isinstance(slc, (list, tuple)):
|
||||||
|
start, stop = slc
|
||||||
|
else:
|
||||||
|
raise NotImplementedError(f"This type of input is not supported")
|
||||||
|
start_date = pd.Timestamp(fn(start))
|
||||||
|
end_date = pd.Timestamp(fn(stop))
|
||||||
obj = copy.copy(self) # shallow copy
|
obj = copy.copy(self) # shallow copy
|
||||||
# NOTE: Seriable will disable copy `self._data` so we manually assign them here
|
# NOTE: Seriable will disable copy `self._data` so we manually assign them here
|
||||||
obj._data = self._data # reference (no copy)
|
obj._data = self._data # reference (no copy)
|
||||||
|
|||||||
Reference in New Issue
Block a user