qlib
qlib copied to clipboard
fix panic during normalizing the invalid data
Description
Fix the panic when normalizing the invalid data.
Before the fix:
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "scripts/data_collector/yahoo/collector.py", line 1018, in <module>
fire.Fire(Run)
File "/home/yang/Devenv/miniconda/envs/qlib/lib/python3.8/site-packages/fire/core.py", line 141, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "/home/yang/Devenv/miniconda/envs/qlib/lib/python3.8/site-packages/fire/core.py", line 475, in _Fire
component, remaining_args = _CallAndUpdateTrace(
File "/home/yang/Devenv/miniconda/envs/qlib/lib/python3.8/site-packages/fire/core.py", line 691, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "scripts/data_collector/yahoo/collector.py", line 837, in normalize_data
super(Run, self).normalize_data(
File "/home/yang/Workspace/github.com/m3ngyang/qlib/scripts/data_collector/base.py", line 438, in normalize_data
yc.normalize()
File "/home/yang/Workspace/github.com/m3ngyang/qlib/scripts/data_collector/base.py", line 317, in normalize
for _ in worker.map(self._executor, file_list):
File "/home/yang/Devenv/miniconda/envs/qlib/lib/python3.8/concurrent/futures/process.py", line 484, in _chain_from_iterable_of_lists
for element in iterable:
File "/home/yang/Devenv/miniconda/envs/qlib/lib/python3.8/concurrent/futures/_base.py", line 619, in result_iterator
yield fs.pop().result()
File "/home/yang/Devenv/miniconda/envs/qlib/lib/python3.8/concurrent/futures/_base.py", line 444, in result
return self.__get_result()
File "/home/yang/Devenv/miniconda/envs/qlib/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
raise self._exception
KeyError: datetime.date(2015, 1, 2)
After the fix:
Motivation and Context
How Has This Been Tested?
- [x] Pass the test by running:
pytest qlib/tests/test_all_pipeline.py
under upper directory ofqlib
. - [ ] If you are adding a new feature, test on your own test scripts.
Screenshots of Test Results (if appropriate):
-
Pipeline test:
-
Your own tests:
Types of changes
- [x] Fix bugs
- [ ] Add new feature
- [ ] Update documentation
@you-n-g hi, please help review the pr. thx.
@microsoft-github-policy-service agree