microsoft / microsoft/qlib

下载好数据后,运行workflow_by_code.py报错

Open
#1,684 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Python
Stars
48.7k
Forks
7.7k
PR merge metrics
No merged PRs in 30d

Description

PS D:\code\qlib> & D:/ProgramData/Anaconda3/python.exe d:/code/qlib/examples/workflow_by_code.py
[13268:MainThread](2023-10-26 10:44:43,251) INFO - qlib.Initialization - [config.py:416] - default_conf: client.
[13268:MainThread](2023-10-26 10:44:43,253) INFO - qlib.Initialization - [init.py:74] - qlib successfully initialized based on client settings.
[13268:MainThread](2023-10-26 10:44:43,254) INFO - qlib.Initialization - [init.py:76] - data_path={'__DEFAULT_FREQ': WindowsPath('C:/Users/Administrator/.qlib/qlib_data/cn_data')}
[13268:MainThread](2023-10-26 10:45:00,193) ERROR - qlib.workflow - [utils.py:41] - An exception has been raised[TypeError: cannot do slice indexing on Index with these indexers [1892] of type int].
File "d:/code/qlib/examples/workflow_by_code.py", line 26, in
dataset = init_instance_by_config(CSI300_GBDT_TASK["dataset"])

这个错误提示表明在尝试对一个整数进行切片索引操作时出现了问题。切片索引通常用于对序列类型的数据结构(如列表、元组或pandas的Series)进行选择或提取子序列的操作。然而,错误提示中提到的索引是一个整数(1892),而不是一个序列类型,因此无法进行切片操作。

这个错误可能是由于在代码中使用了一个整数类型的索引来访问一个数据结构,而该数据结构并不支持切片操作。为了解决这个问题,我们需要检查代码中使用索引的地方,确保使用正确的数据结构或方法来进行操作。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the command shown for examples/workflow_by_code.py and begin at line 26, where CSI300_GBDT_TASK initializes the dataset. Inspect the full traceback and the index used during dataset construction to identify why integer 1892 reaches pandas slice indexing. Done means the example runs successfully with the downloaded data.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.