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

IndexError when using DataHandlerLP #1831

Open
x7jeon8gi opened this issue Jul 22, 2024 · 0 comments
Open

IndexError when using DataHandlerLP #1831

x7jeon8gi opened this issue Jul 22, 2024 · 0 comments
Labels
question Further information is requested

Comments

@x7jeon8gi
Copy link

Hello,

I am encountering an UnsortedIndexError when using DataHandlerLP in Qlib. It seems to be related to MultiIndex not being lexsorted. Could you provide guidance on how to resolve this issue?

UnsortedIndexError: 'MultiIndex slicing requires the index to be lexsorted: slicing on levels [0], lexsort depth 0'

handler = DataHandlerLP(
    data_loader={
        "class": "QlibDataLoader",
        "kwargs": {
            "config": {
                "feature": market_info,
                "label": ["Ref($close, -2)/Ref($close, -1) - 1"]
            },
        }
    },
    instruments="csi300",
    infer_processors=[
        {
            "class": 'RobustZScoreNorm', 
            'kwargs': {
                'clip_outlier': True, 
                'fields_group': 'feature', 
                'fit_start_time': '2009-01-01', 
                'fit_end_time': '2019-12-31'
            }
        },
        {
            'class': 'Fillna', 
            'kwargs': {
                'fields_group': 'feature',
            }
        },
    ],
    learn_processors=[
        {"class": 'DropnaLabel'},
        {
            "class": 'CSZScoreNorm', 
            'kwargs': {
                'fields_group': 'label',
            }
        },
    ],

)

Thank you.

@x7jeon8gi x7jeon8gi added the question Further information is requested label Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant