bigframes.pandas.DataFrame.swaplevel#

DataFrame.swaplevel(i:int=-2,j:int=-1,axis:int|str=0)[source]#

Swap levels i and j in aMultiIndex.

Default is to swap the two innermost levels of the index.

Parameters:
  • i (int orstr) – Levels of the indices to be swapped. Can pass level name as string.

  • j (int orstr) – Levels of the indices to be swapped. Can pass level name as string.

  • axis ({0 or'index',1 or'columns'},default 0) – The axis to swap levels on. 0 or ‘index’ for row-wise, 1 or‘columns’ for column-wise.

Returns:

DataFrame with levels swapped in MultiIndex.

Return type:

bigframes.pandas.DataFrame

Raises:

ValueError – If columns are not multi-index.

This Page