-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG/Not Implemented Panel.to_frame() with MultiIndex #5402
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
verify_integrity vs validate: verify_integrity means 'everything matches up' and is non-trivial (ie all validate means 'check that the length of the names/levels/labels are the So validate is internal to MI, whereas verify_integrity is more external (because internal functions that reconstruct MI know that they are valid integrity-wise, so they can set that to False). doesn't matter to verify integrity on set_names, because they just get set on levelsets themselves and don't matter for integrity purposes (if the lengths match, you're golden). |
edited my comment to be complete explanation. |
In particular, this means that doing |
Ok thanks for the explanation. The thread where you worked on MultiIndex was also hugely informative. Are there any fundamental objections to being able to do |
@TomAugspurger would welcome this..... |
Ok. I'll write some more tests to go along with this. The bug comes from trying to build the result |
it's a little weird, but not impossible, for MultiIndex(MultiIndex) to just |
Ya I couldn't think of any reasons that would be useful either. On Nov 1, 2013, at 4:04 PM, "Jeff Tratner" <[email protected]mailto:[email protected]> wrote: it's a little weird, but not impossible, for MultiIndex(MultiIndex) to just — |
Fixes bug that caused failure on Panel.to_frame() if major_axis was a MultiIndex (pandas-dev#5402) refactor reindexing to index.py API/REF: refactor bits to index. rename
Should this be doable?
I think the issue comes when the index of the lower dimensional DataFrame (
df
in this case) is already a MultiIndex. These two work:I was expecting that
wp.to_frame()
would create a new MultiIndex with 3 levels:The ordering of the new MultiIndex (with
wp.items
inserted) is ambiguous... But something like that. You could always swaplevels later.(side note to myself: check on if
verify_integrity
isvalidate
in MultiIndex land. It doesn't get passed to_set_names
).The text was updated successfully, but these errors were encountered: