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

ValueError: The name datetime occurs multiple times, use a level number #1893

Open
Yuhang-Harry-Gao opened this issue Mar 7, 2025 · 1 comment
Labels
question Further information is requested

Comments

@Yuhang-Harry-Gao
Copy link

仅在workflow中将Alpha158改成Alpha360后,「prediction, backtest & analysis」环节出现ValueError: The name datetime occurs multiple times, use a level number

@Yuhang-Harry-Gao Yuhang-Harry-Gao added the question Further information is requested label Mar 7, 2025
@EnjoyLeole
Copy link

EnjoyLeole commented Mar 16, 2025

Similar problem, when use:
analysis_position.rank_label_graph(positions, label_df)

It was caused in line 171, qlib/contrib/report/analysis_position/parse_position.py

_position_df = parse_position(position)

This generate dataframe with multiindex ['instruments','datetime']

if calculate_label_rank:
    _position_df = _calculate_label_rank(_position_df)

Dataframe transfer to multiindex ['datetime','instruments','datetime'] , and caused the above error

Droplevel could fix it:
_position_df = _position_df.droplevel(level=0, )

csh589 pushed a commit to csh589/qlib that referenced this issue Mar 21, 2025
- adapt pandas >= 1.5.0
- add group_keys when the result from apply is a like-indexed Series or DataFrame
csh589 added a commit to csh589/qlib that referenced this issue Mar 21, 2025
- adapt pandas >= 1.5.0
- add group_keys when the result from apply is a like-indexed Series or DataFrame
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

2 participants