pandas MultiIndex with duplicate values in one level

I need to replace the values of one level of pandas MultiIndex with another set of values. This is easily done with set_levels unless the new set contains duplicates, i.e. two or more values from the original set of level values are mapped…