I have a pandas dataframe with a (two-level) multi-index and would like to swap levels only if a condition is met. In my case, the condition is if the second in