🍾 Xarray is now 10 years old! 🎉

xarray.IndexVariable.set_dims

xarray.IndexVariable.set_dims#

IndexVariable.set_dims(dims, shape=None)[source]#

Return a new variable with given set of dimensions. This method might be used to attach new dimension(s) to variable.

When possible, this operation does not copy this variable’s data.

Parameters:

dims (str or sequence of str or dict) – Dimensions to include on the new variable. If a dict, values are used to provide the sizes of new dimensions; otherwise, new dimensions are inserted with length 1.

Returns:

Variable