Skip to content

fix(qlib): normalize MultiIndex levels before concat in factor_runner#1375

Open
JasonOA888 wants to merge 3 commits intomicrosoft:mainfrom
JasonOA888:fix/issue-678-multiindex-concat
Open

fix(qlib): normalize MultiIndex levels before concat in factor_runner#1375
JasonOA888 wants to merge 3 commits intomicrosoft:mainfrom
JasonOA888:fix/issue-678-multiindex-concat

Conversation

@JasonOA888
Copy link
Copy Markdown

@JasonOA888 JasonOA888 commented Apr 1, 2026

Fixes #678

Some LLM-generated factors produce a 3-level MultiIndex (e.g. instrument, datetime, instrument) while others use the standard 2-level (datetime, instrument). pd.concat raises AssertionError: Length of new_levels must be <= self.nlevels.

This fix detects mismatched index levels before concat and normalizes by dropping the extra (duplicate) level from 3-level indices.


📚 Documentation preview 📚: https://RDAgent--1375.org.readthedocs.build/en/1375/

…consumers

Messages tagged with 'evolving code' were stored under the full msg.tag
key (e.g. 'development.evoving code') but downstream code reads from
state.msgs[round]['evolving code']. This caused the UI to always show
an empty evolving code list.

Fixes microsoft#1021
Some LLM providers (e.g. Volcengine) return Python-style booleans
(True/False/None) instead of JSON-standard (true/false/null). This
causes json.loads to fail with JSONDecodeError.

Fixes microsoft#916
Some factors produce a 3-level MultiIndex (instrument, datetime,
instrument) while others use the standard 2-level (datetime,
instrument). pd.concat raises AssertionError when levels don't match.

Fixes microsoft#678
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fail to concat factors with different MultiIndex

1 participant