append new row to numpy array code example
Example 1: append row to array python
import numpy as np
newrow = [1,2,3]
A = np.vstack([A, newrow])
Example 2: how append row in numpy
import numpy as np
arr = np.empty((0,3), int)
print("Empty array:")
print(arr)
arr = np.append(arr, np.array([[10,20,30]]), axis=0)
arr = np.append(arr, np.array([[40,50,60]]), axis=0)
print("After adding two new arrays:")
print(arr)