transpose

UnitsAwareDataArray.transpose(*dim: Hashable, transpose_coords: bool = True, missing_dims: ErrorOptionsWithWarn = 'raise') Self

Return a new DataArray object with transposed dimensions.

Parameters:
  • *dim (Hashable, optional) – By default, reverse the dimensions. Otherwise, reorder the dimensions to this order.

  • transpose_coords (bool, default: True) – If True, also transpose the coordinates of this DataArray.

  • missing_dims ({"raise", "warn", "ignore"}, default: "raise") – What to do if dimensions that should be selected from are not present in the DataArray: - “raise”: raise an exception - “warn”: raise a warning, and ignore the missing dimensions - “ignore”: ignore the missing dimensions

Returns:

transposed – The returned DataArray’s array is transposed.

Return type:

DataArray

Notes

This operation returns a view of this array’s data. It is lazy for dask-backed DataArrays but not for numpy-backed DataArrays – the data will be fully loaded.

See also

numpy.transpose, Dataset.transpose