code: def reorder_levels(self, order):
          
          if not isinstance(self.index, MultiIndex):  # pragma: no cover
              raise Exception('Can only reorder levels on a hierarchical axis.')
  
          result = self.copy()
          result.index = result.index.reorder_levels(order)
          return result
docs: Rearrange index levels using input order.
  
          May not drop or duplicate levels.
  
          Parameters
          ----------
          order : list of int representing new level order
                 (reference level by number or key)
  
          Returns
          -------
          type of caller (new object)