Home > Article > Backend Development > Examples of numpy array splicing, merging rows and columns respectively
This article mainly introduces examples of array splicing in numpy, merging rows and columns respectively. It has a certain reference value. Now I share it with you. Friends in need can refer to it
When performing data analysis, will some sample data with multiple characteristics be spliced and merged, analyzed together, and predicted....
The following is an array using functions in numpy of splicing.
(1) Method one. np.vstack() v means vertical, that is, vertical splicing and np.hstack() h means Horizontal
(2) Method 2, np.c_[array1,array2] c_represents the column column np.r_[array1,array2] r_represents the row row
Related recommendations:
numpy’s extension method for merging multi-dimensional matrices and lists
How to implement it Delete rows or columns in numpy.array
The above is the detailed content of Examples of numpy array splicing, merging rows and columns respectively. For more information, please follow other related articles on the PHP Chinese website!