xarray.DataArray.transpose#
- DataArray.transpose(*dims, transpose_coords=True, missing_dims='raise')[source]#
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 (
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 (
DataArray
) – The returned DataArray’s array is transposed.
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