numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
hstack(tup)

This is equivalent to concatenation along the second axis, except for 1-D arrays where it concatenates along the first axis. Rebuilds arrays divided by hsplit .

This function makes most sense for arrays with up to 3 dimensions. For instance, for pixel-data with a height (first axis), width (second axis), and r/g/b channels (third axis). The functions concatenate , stack and block provide more general stacking and concatenation operations.

Parameters

tup : sequence of ndarrays

The arrays must have the same shape along all but the second axis, except 1-D arrays which can be any length.

Returns

stacked : ndarray

The array formed by stacking the given arrays.

Stack arrays in sequence horizontally (column wise).

See Also

block

Assemble an nd-array from nested lists of blocks.

column_stack

Stack 1-D arrays as columns into a 2-D array.

concatenate

Join a sequence of arrays along an existing axis.

dstack

Stack arrays in sequence depth wise (along third axis).

hsplit

Split an array into multiple sub-arrays horizontally (column-wise).

stack

Join a sequence of arrays along a new axis.

vstack

Stack arrays in sequence vertically (row wise).

Examples

>>> a = np.array((1,2,3))
... b = np.array((4,5,6))
... np.hstack((a,b)) array([1, 2, 3, 4, 5, 6])
>>> a = np.array([[1],[2],[3]])
... b = np.array([[4],[5],[6]])
... np.hstack((a,b)) array([[1, 4], [2, 5], [3, 6]])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.ma.extras.dstack numpy.column_stack numpy.dstack dask.array.routines.hstack scipy.spatial._qhull.HalfspaceIntersection numpy.block numpy.concatenate numpy.core._multiarray_umath.concatenate numpy.vstack numpy.split numpy.ma.extras.vstack numpy.ma.extras.column_stack

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/core/shape_base.py#285
type: <class 'function'>
Commit: