cfdm.Data.transpose

Data.transpose(axes=None, inplace=False)[source]

Permute the axes of the data array.

New in version (cfdm): 1.7.0

Parameters
axes: (sequence of) int

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
Data or None

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

Examples

>>> d.shape
(19, 73, 96)
>>> d.transpose().shape
(96, 73, 19)
>>> d.transpose([1, 0, 2]).shape
(73, 19, 96)
>>> d.transpose([-1, 0, 1], inplace=True)
>>> d.shape
(96, 19, 73)