DataArray.expand_dims(dim, axis=None)

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.


dim : str or sequence of str.

Dimensions to include on the new variable. dimensions are inserted with length 1.

axis : integer, 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.


expanded : same type as caller

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