cf.Data.swapaxes

Data.swapaxes(axis0, axis1)[source]

Swap the positions of two axes.

Parameters :
axis0, axis1 :

Select the axes to swap. Arguments axis0 and axis1 are each one of:

  • An internal axis identifier. Selects this axis.
  • An integer. Selects the axis coresponding to the given position in the list of axes of the data array.
Returns :

None

Examples

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

Previous topic

cf.Data.squeeze

Next topic

cf.Data.tan

This Page