numpy.concatenate() function in Python | Merge Numpy Arrays
numpy.concatenate(): This function Join a sequence of arrays along an existing axis. This function helps us to merge arrays.
Syntax: numpy.concatenate((a1, a2, …), axis=0, out=None)
a1, a2, … : sequence of array_like
The arrays must have the same shape, except in the dimension corresponding to axis (the first, by default).
axis : int, optional
The axis along which the arrays will be joined. If axis is None, arrays are flattened before use. Default is 0.
out : ndarray, optional
If provided, the destination to place the result. The shape must be correct, matching that of what concatenate would have returned if no out argument were specified.
res : ndarray
The concatenated array.
import numpy as np a= np.array([[1,2],[2,3]]) b= np.array([[3,4],[4,5]]) c=np.concatenate((a, b), axis=0) print(c) d=np.concatenate((a, b), axis=1) print(d)