How does one add rows to a numpy array?
I have an array A:
A = array([[0, 1, 2], [0, 2, 0]])
I wish to add rows to this array from
You can use numpy.append() to append a row to numpty array and reshape to a matrix later on.
numpy.append()
import numpy as np a = np.array([1,2]) a = np.append(a, [3,4]) print a # [1,2,3,4] # in your example A = [1,2] for row in X: A = np.append(A, row)