DataArray.expand_dims(dim: Union[None, Hashable, Sequence[Hashable], Mapping[Hashable, Any]] = None, axis=None, **dim_kwargs) → xarray.core.dataarray.DataArray

Return a new object with an additional axis (or axes) inserted at the corresponding position in the array shape.

If dim is already a scalar coordinate, it will be promoted to a 1D coordinate consisting of a single value.

dimhashable, sequence of hashable, dict, or None

Dimensions to include on the new variable. If provided as str or sequence of str, then dimensions are inserted with length 1. If provided as a dict, then the keys are the new dimensions and the values are either integers (giving the length of the new dimensions) or sequence/ndarray (giving the coordinates of the new dimensions). WARNING for python 3.5, if dim is dict-like, then it must be an OrderedDict. This is to ensure that the order in which the dims are given is maintained.

axisinteger, list (or tuple) of integers, or None

Axis position(s) where new axis is to be inserted (position(s) on the result array). If a list (or tuple) of integers is passed, multiple axes are inserted. In this case, dim arguments should be same length list. If axis=None is passed, all the axes will be inserted to the start of the result array.

**dim_kwargsint or sequence/ndarray

The keywords are arbitrary dimensions being inserted and the values are either the lengths of the new dims (if int is given), or their coordinates. Note, this is an alternative to passing a dict to the dim kwarg and will only be used if dim is None. WARNING for python 3.5 dim_kwargs is not available.

expandedsame type as caller

This object, but with an additional dimension(s).