chaospy.expand_dims

chaospy.expand_dims(a: Union[numpy._typing._array_like._SupportsArray[numpy.dtype], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]], numpoly.baseclass.ndpoly], axis: int) numpoly.baseclass.ndpoly[source]

Expand the shape of an array.

Insert a new axis that will appear at the axis position in the expanded array shape.

Args:
a:

Input array.

axis:

Position in the expanded axes where the new axis is placed.

Return:

View of a with the number of dimensions increased by one.

Example:
>>> poly = numpoly.variable(2)
>>> numpoly.expand_dims(poly, axis=0)
polynomial([[q0, q1]])
>>> numpoly.expand_dims(poly, axis=1)
polynomial([[q0],
            [q1]])