xarray.IndexVariable.stack

xarray.IndexVariable.stack#

IndexVariable.stack(dim=None, **dim_kwargs)[source]#

Stack any number of existing dim into a single new dimension.

New dim will be added at the end, and the order of the data along each new dimension will be in contiguous (C) order.

Parameters
  • dim (mapping of hashable to tuple of hashable) – Mapping of form new_name=(dim1, dim2, …) describing the names of new dim, and the existing dim that they replace.

  • **dim_kwargs – The keyword arguments form of dim. One of dim or dim_kwargs must be provided.

Returns

stacked (Variable) – Variable with the same attributes but stacked data.

See also

Variable.unstack