xarray.Index.stack#

classmethod Index.stack(variables, dim)[source]#

Create a new index by stacking coordinate variables into a new dimension.

Implementation is optional but required in order to support stack. Otherwise it will raise an error when trying to pass the Index subclass as argument to Dataset.stack().

Parameters:
  • variables (dict-like) – Mapping of Variable objects to stack together.

  • dim (Hashable) – Name of the new, stacked dimension.

Returns:

index – A new Index object.