xarray.DataArray.set_index¶
-
DataArray.
set_index
(append=False, inplace=False, **indexes)¶ Set DataArray (multi-)indexes using one or more existing coordinates.
Parameters: append : bool, optional
If True, append the supplied index(es) to the existing index(es). Otherwise replace the existing index(es) (default).
inplace : bool, optional
If True, set new index(es) in-place. Otherwise, return a new DataArray object.
**indexes : {dim: index, ...}
Keyword arguments with names matching dimensions and values given by (lists of) the names of existing coordinates or variables to set as new (multi-)index.
Returns: obj : DataArray
Another dataarray, with this dataarray’s data but replaced coordinates.
See also