You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MMCMA
changed the title
ENH:
ENH: additional operator arguments for more expliziz control over MultiIndex levels
May 7, 2022
MMCMA
changed the title
ENH: additional operator arguments for more expliziz control over MultiIndex levels
ENH: additional operator arguments for more explicit control over MultiIndex levels
May 7, 2022
I think your current solution is good : df_1.swaplevel().mul(df_2, axis=0, level=1).swaplevel(); I think the issue stems from the fact that the dataframes have different indices, and as such some alignment must occur; if you try : df_1.mul(df_2.set_index(df_1.index), axis = 0, level = 1), it works out fine. It might be an easy stuff to implement - I feel it might introduce another level of complexity (MultiIndex is already a relatively complex idea), and may not be so intuitive long run. So maybe the onus should be on the user to align the indices (either index or columns) before running the binary operation
Is your feature request related to a problem?
More explizit operator (add, sub, mul...) index level control when working with pd.MultiIndex on both index and column dimension
Describe the solution you'd like
Additional arguments in operator function to control both index and column level usage.
API breaking implications
Not sure
Describe alternatives you've considered
See code solution below
Additional context
Maybe there is another more elegant solution already in place and I just missed it
The text was updated successfully, but these errors were encountered: