xarray.DataArray.transpose

DataArray.transpose(self, *dims: Hashable, transpose_coords: bool = None) → 'DataArray'

Return a new DataArray object with transposed dimensions.

Parameters
  • *dims (hashable, optional) – By default, reverse the dimensions. Otherwise, reorder the dimensions to this order.

  • transpose_coords (boolean, optional) – If True, also transpose the coordinates of this DataArray.

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()