-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
MultiIndex - ValueError: On level 2, label max (1) >= length of level (1). NOTE: this index is in an inconsistent state #13741
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
Comments
See also the discussion on gitter |
This works (needed values to align.
|
Is there a better way to align? |
I am reopening as there does not seem to be consistent behavior for a cumprod formula? |
Code for checking:
|
Great 👍 The work around I am using is:
|
@toasteez If I understand your question correctly, the issue here is that
and then change the That's what's happening in your example. The columns for
and if you set the last level to be a list of length 1, your If you want to reset the level from scratch, you would need to do |
@jorisvandenbossche I think this can be closed unless @toasteez objects -- I don't see any further action here. |
I think this is still not working. In this case, selecting top-level columns from a multiindex of a df:
and then making the result is bigger than |
I still get this error when trying to set level values of a multiindex. |
Create MultiIndex DataFrame
Add a column at Level 2
I can repeat the add a column at Level 2 code above multiple times, however if I try the following I get an error (possibly related to NAN's):
Expected Output - ( daily_returns is added to level 2 ( daily_added_value * amount )
Note I have put zeros as expected values but the desired output is daily_added_value * amount) I am also adding other measures at level 2 with division and shift() in the formulae. These fail with same error.
Error
How do you make the index consistent?
output of
pd.show_versions()
This post is also raised as a question and also related to this question
The text was updated successfully, but these errors were encountered: