parameters: (self: FrameOrSeries, axis1, axis2, copy=True)
return_statement: return self._constructor(
              # error: Argument 1 to "NDFrame" has incompatible type "ndarray"; expected
              # "Union[ArrayManager, BlockManager]"
              # error: Argument 2 to "NDFrame" has incompatible type "*Generator[Index,
              # None, None]"; expected "bool" [arg-type]
              # error: Argument 2 to "NDFrame" has incompatible type "*Generator[Index,
              # None, None]"; expected "Optional[Mapping[Hashable, Any]]"
              new_values,  # type: ignore[arg-type]
              *new_axes,  # type: ignore[arg-type]
          ).__finalize__(self, method="swapaxes")
docstring: Interchange axes and swap values axes appropriately.
  
          Returns
          -------
          y : same as input
docstring_summary: Interchange axes and swap values axes appropriately.
docstring_tokens: Interchange axes and swap values axes appropriately .
function: def swapaxes(self: FrameOrSeries, axis1, axis2, copy=True) -> FrameOrSeries:
          """
          Interchange axes and swap values axes appropriately.
  
          Returns
          -------
          y : same as input
          """
          i = self._get_axis_number(axis1)
          j = self._get_axis_number(axis2)
  
          if i == j:
              if copy:
                  return self.copy()
              return self
  
          mapping = {i: j, j: i}
  
          new_axes = (self._get_axis(mapping.get(k, k)) for k in range(self._AXIS_LEN))
          new_values = self.values.swapaxes(i, j)
          if copy:
              new_values = new_values.copy()
  
          # ignore needed because of NDFrame constructor is different than
          # DataFrame/Series constructors.
          return self._constructor(
              # error: Argument 1 to "NDFrame" has incompatible type "ndarray"; expected
              # "Union[ArrayManager, BlockManager]"
              # error: Argument 2 to "NDFrame" has incompatible type "*Generator[Index,
              # None, None]"; expected "bool" [arg-type]
              # error: Argument 2 to "NDFrame" has incompatible type "*Generator[Index,
              # None, None]"; expected "Optional[Mapping[Hashable, Any]]"
              new_values,  # type: ignore[arg-type]
              *new_axes,  # type: ignore[arg-type]
          ).__finalize__(self, method="swapaxes")
function_tokens: def swapaxes ( self : FrameOrSeries , axis1 , axis2 , copy = True ) -> FrameOrSeries : i = self . _get_axis_number ( axis1 ) j = self . _get_axis_number ( axis2 ) if i == j : if copy : return self . copy ( ) return self mapping = { i : j , j : i } new_axes = ( self . _get_axis ( mapping . get ( k , k ) ) for k in range ( self . _AXIS_LEN ) ) new_values = self . values . swapaxes ( i , j ) if copy : new_values = new_values . copy ( ) # ignore needed because of NDFrame constructor is different than # DataFrame/Series constructors. return self . _constructor ( # error: Argument 1 to "NDFrame" has incompatible type "ndarray"; expected # "Union[ArrayManager, BlockManager]" # error: Argument 2 to "NDFrame" has incompatible type "*Generator[Index, # None, None]"; expected "bool" [arg-type] # error: Argument 2 to "NDFrame" has incompatible type "*Generator[Index, # None, None]"; expected "Optional[Mapping[Hashable, Any]]" new_values , # type: ignore[arg-type] * new_axes , # type: ignore[arg-type] ) . __finalize__ ( self , method = "swapaxes" )