cfdm.Index.transpose

Index.transpose(*args, **kwargs)[source]

Permute the axes of the data array.

New in version (cfdm): 1.7.0

Parameters
axes: (sequence of) int, optional

The new axis order. By default the order is reversed.

Each axis is identified by its integer position in the data. Negative integers counting from the last position are allowed.

Parameter example:

axes=0

Parameter example:

axes=-1

Parameter example:

axes=[1, -2]

inplace: bool, optional

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

Returns
Index or None

A new instance with permuted data axes. If the operation was in-place then None is returned.

Examples

>>> f.shape
(19, 73, 96)
>>> f.transpose().shape
(96, 73, 19)
>>> f.transpose([1, 0, 2]).shape
(73, 19, 96)