COO.swapaxes

COO.swapaxes(axis1, axis2)[source]

Returns array that has axes axis1 and axis2 swapped.

Parameters
  • axis1 (int) – first axis to swap

  • axis2 (int) – second axis to swap

Returns

The new array with the axes axis1 and axis2 swapped.

Return type

COO

Examples

>>> x = COO.from_numpy(np.ones((2, 3, 4)))
>>> x.swapaxes(0, 2)
<COO: shape=(4, 3, 2), dtype=float64, nnz=24, fill_value=0.0>