SoFunction
Updated on 2024-11-19

Example of adding a row or column to a python matrix

Add rows to the matrix

np.row_stack() together with np.column_stack()
import numpy as np
a = ([[4, 4,], [5, 5]])
c = np.row_stack((a, [8,9]))
d = np.column_stack((a, [8,9]))

The above example of adding a row or column to a python matrix is all that I have shared with you.