ENH: reindex and align with two multiindex dataframes #13409
Labels
Duplicate Report
Duplicate issue or pull request
MultiIndex
Reshaping
Concat, Merge/Join, Stack/Unstack, Explode
The Advanced reindexing and alignment section of the documentation describes a method for filling data based on a partial match of indexes.
In this example, one level of a multiindex is dropped and data is copied based on a match of the remaining levels. This example only works because the original multiindex only had 2 levels so that when one level was dropped, the remaining index is no longer a multiindex. Unfortunately in practice you might end up wanting to align or reindex two multiindex based on the remaining levels (as I do), but it seems this behavior is not supported..
the result of the last command is
TypeError: Join on level between two MultiIndex objects is ambiguous
Particularly with named index levels, it not clear how this is ambiguous..
When you attempt an
align
where level is specified you end up with the sameTypeError
and when you attemptyou get a
NotImplementedError
Based on the example in the documentation you would expect that dropping a multiindex level then reindexing in order to duplicate some data across the dropped index level would work. It is surprising that this doesn't work. Is there a way to implement this functionality?
The text was updated successfully, but these errors were encountered: