There are many ways to merge numpy arrays in Python, such as
-Np.append ()
-Np.concatenate ()
-Np.stack ()
-Np.hstack ()
-Np.vstack ()
-Np.dstack ()
One of the most ubiquitous is the first and the second. The first readability is good, more flexible, but the memory is big. The second one does not have a large memory footprint problem. Method A--append
Parameters |
Introduction |
Arr |
Replication of arrays to be merged (special home page is copy , so much more memory is consumed) |
Values |
The value to merge into the above array copy. If the following parameter axis is specified, the values must be equal to the arr shape (shape[axis), otherwise there is no requirement. |
Axis |
Axes to merge |
Routines:
Method Two--concatenate
Parameters |
Introduction |
*arrays |
These arrays must have the same shape in addition to the axis (default axis=0) to be merged |
Axis |
The axis to be merged, defaults to 0 |
Routines: