BUG/API Raise ValueError for non-unique stack by name by TomAugspurger · Pull Request #6738 · pandas-dev/pandas (original) (raw)

Closes #6729

We should raise a ValueError when (un)stacking and referring to a non-unique index name. You can still stack and unstack by position like normal (no ambiguity there, unless your names are integers and that integer is duplicated, in which case we'll raise a ValueError).

Right now I'm assuming that index names are always hashable, but that's not necessarily true, is it? Any good ways to check the uniqueness of the names? I didn't see anything on MultiIndex that did this.