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