🍾 Xarray is now 10 years old! 🎉

xarray.Variable.transpose

xarray.Variable.transpose#

Variable.transpose(*dims, missing_dims='raise')[source]#

Return a new Variable object with transposed dimensions.

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

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

Returns:

transposed (Variable) – The returned object has transposed data and dimensions with the same attributes as the original.

Notes

This operation returns a view of this variable’s data. It is lazy for dask-backed Variables but not for numpy-backed Variables.

See also

numpy.transpose