Home > Article > Backend Development > Example of adding a row or column to a python matrix_python
Below I will share with you an example of adding a row or column to a Python matrix. It has a good reference value and I hope it will be helpful to everyone. Let’s take a look together
Add rows to the matrix
np.row_stack() 与 np.column_stack() import numpy as np a = np.array([[4, 4,], [5, 5]]) c = np.row_stack((a, [8,9])) d = np.column_stack((a, [8,9]))
Related recommendations:
Distance measurement and python implementation
Python implementation of two-dimensional array output as picture_python
The above is the detailed content of Example of adding a row or column to a python matrix_python. For more information, please follow other related articles on the PHP Chinese website!