numpy.stack() in Python

The numpy.stack() function joins a sequence of arrays along a new axis.



arrays: This parameter represents a sequence of the array where each array have the same shape.

axis: It is an optional parameter which takes integer values. It represents the axis along which the arrays will be joined.

out: This parameter represents the destination to place the result.


This function returns the stacked array which has one or more dimension than the input arrays.

Example 1


Pin It on Pinterest

Share This