cf.Data.expand_dims

Data.expand_dims(axis=0, dim=None, direction=True)[source]

Expand the shape of the data array in place.

Insert a new size 1 axis, corresponding to a given position in the data array shape.

Not to be confused with the expand_partition_dims method.

Parameters :
axis : int, optional

Position (amongst axes) where new axis is to be inserted. By default, insert at position 0.

dim : str, optional

direction : bool, optional

Returns :

None

Raises :
ValueError :

If the given dimension identity is already in use.

Examples

>>> d.expand_dims(1)
>>> d.expand_dims(2, 'dim3')
>>> d.expand_dims(0, None, False)

Previous topic

cf.Data.equals

Next topic

cf.Data.flat

This Page