xarray.Dataset.set_xindex#
- Dataset.set_xindex(coord_names, index_cls=None, **options)[source]#
Set a new, Xarray-compatible index from one or more existing coordinate(s).
- Parameters:
coord_names (
strorlist) – Name(s) of the coordinate(s) used to build the index. If several names are given, their order matters.index_cls (
subclassofIndex, optional) – The type of index to create. By default, try setting aPandasIndexiflen(coord_names) == 1, otherwise aPandasMultiIndex.**options – Options passed to the index constructor.
- Returns:
obj (
Dataset) – Another dataset, with this dataset’s data and with a new index.