Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix panic during normalizing the invalid data #1698

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

m3ngyang
Copy link
Contributor

@m3ngyang m3ngyang commented Nov 22, 2023

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:

image

Motivation and Context

How Has This Been Tested?

  • Pass the test by running: pytest qlib/tests/test_all_pipeline.py under upper directory of qlib.
  • If you are adding a new feature, test on your own test scripts.

Screenshots of Test Results (if appropriate):

  1. Pipeline test:
image
  1. Your own tests:

Types of changes

  • Fix bugs
  • Add new feature
  • Update documentation

@github-actions github-actions bot added the waiting for triage Cannot auto-triage, wait for triage. label Nov 22, 2023
@m3ngyang m3ngyang changed the title fix panic during normlizing the invalid data fix panic during normalizing the invalid data Nov 22, 2023
@m3ngyang
Copy link
Contributor Author

@you-n-g hi, please help review the pr. thx.

@m3ngyang
Copy link
Contributor Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for triage Cannot auto-triage, wait for triage.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant