xarray.DataArray.swap_dims

DataArray.swap_dims(dims_dict)

Returns a new DataArray with swapped dimensions.

Parameters:

dims_dict : dict-like

Dictionary whose keys are current dimension names and whose values are new names. Each value must already be a coordinate on this array.

Returns:

renamed : Dataset

DataArray with swapped dimensions.