def swaplevel(self, i=-<NUM_LIT:2>, j=-<NUM_LIT:1>, axis=<NUM_LIT:0>):
result = self.copy()<EOL>axis = self._get_axis_number(axis)<EOL>if axis == <NUM_LIT:0>:<EOL><INDENT>result.index = result.index.swaplevel(i, j)<EOL><DEDENT>else:<EOL><INDENT>result.columns = result.columns.swaplevel(i, j)<EOL><DEDENT>return result<EOL>
Swap levels i and j in a MultiIndex on a particular axis.

Parameters
----------
i, j : int, string (can be mixed)
    Level of index to be swapped. Can pass level name as string.

Returns
-------
DataFrame

.. versionchanged:: 0.18.1

   The indexes ``i`` and ``j`` are now optional, and default to
   the two innermost levels of the index.