qlib icon indicating copy to clipboard operation
qlib copied to clipboard

执行yahoo normalize data 发生 ValueError: unconverted data remains when parsing with format "%Y-%m-%d" 错误

Open lianzhaowen opened this issue 3 months ago • 2 comments

🐛 Bug Description

To Reproduce

Steps to reproduce the behavior:

1.python scripts/data_collector/yahoo/collector.py normalize_data --source_dir ~/.qlib/stock_data/source/cn_data --normalize_dir ~/.qlib/stock_data/normalize/cn_data --region CN --interval 1d 2.我已经下载了cn_data数据,normalize 过程中,在第341 sh600489.csv 发生错误

Expected Behavior

Screenshot

File "E:\Data\PROGRAM\Python\source\qlib\scripts\data_collector\yahoo\collector.py", line 395, in normalize_yahoo df.index = pd.to_datetime(df.index) ...

ValueError: unconverted data remains when parsing with format "%Y-%m-%d": " 09:30:00+08:00", at position 1343. You might want to try: - passing format if your strings have a consistent format; - passing format='ISO8601' if your strings are all ISO8601 but not necessarily in exactly the same format; - passing format='mixed', and the format will be inferred for each element individually. You might want to use dayfirst alongside this.

Environment

Note: User could run cd scripts && python collect_info.py all under project directory to get system information and paste them here directly.

  • Qlib version:0.9.7
  • Python version: 3.12.9
  • OS (Windows, Linux, MacOS): windows

下载的原始数据 sh600468.csv sh600469.csv

归一后的数据

sh600467.csv sh600468.csv

  • Commit number (optional, please provide it if you are using the dev version):

Additional Notes

lianzhaowen avatar Sep 18 '25 13:09 lianzhaowen

Hi, @lianzhaowen Thank you for your attention to qlib. The issue you mentioned has been fixed in PR 2015. Please pull the fix_nor_bug branch locally and try again.

SunsetWolf avatar Sep 19 '25 09:09 SunsetWolf

可以了,谢谢

lianzhaowen avatar Sep 21 '25 06:09 lianzhaowen