cf.Data.swapaxes

Data.swapaxes(axis0, axis1, inplace=False, i=False)[source]

Interchange two axes of an array.

Parameters:
axis0, axis1 : ints

Select the axes to swap. Each axis is identified by its original integer position.

inplace: bool, optional

If True then do the operation in-place and return None.

i: deprecated at version 3.0.0

Use inplace parameter instead.

Returns:

Data

Examples:

>>> d=cf.Data([[[1, 2, 3], [4, 5, 6]]])
>>> d.shape
(1, 2, 3)
>>> d.swapaxes(1, 0).shape
>>> d.swapaxes(2, 1).shape
>>> d.swapaxes(0, -1).shape
>>> d.swapaxes(1, 1).shape