numpy.hstack() in Python

The numpy.hstack() function stacks the arrays in a sequence horizontally (column wise).

Syntax

Parameter

tup: This parameter represents the sequence of ‘ndarrays’ where the arrays must have the same shape, except 1-D arrays which can be of any length.

Return

The function returns the array formed by stacking the given arrays.

Example 1

Output

Example 2

Output

Pin It on Pinterest

Share This