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
When calling unstack(level=1) on a MultiIndex with integer names, it is ambiguous whether to unstack by level name or the level position since both are valid level identifiers in unstack() (but will prioritize level name)
While possibly an uncommon case, a keyword identifier in unstack() may help clarify whether the user wants to unstack by the level position or level name.
IMO I think a signature of unstack(level=None, name=None, fill_value=None) would be better. It could still default to stacking by the last level, but the user can clearly specify to unstack by the level position or level name. Mixing arguments can raise as ambiguous.
Code Sample, a copy-pastable example if possible
Problem description
Related #14969
When calling
unstack(level=1)
on aMultiIndex
with integer names, it is ambiguous whether to unstack by level name or the level position since both are valid level identifiers in unstack() (but will prioritize level name)While possibly an uncommon case, a keyword identifier in
unstack()
may help clarify whether the user wants to unstack by the level position or level name.Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: