xarray.Index.stack#

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

Create a new index by stacking coordinate variables into a single 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.