adding value to array python np code example
Example 1: append value to numpy array
x = np.random.randint(2, size=10)
x = np.append(x, 2)
Example 2: numpy python add array
x1 = [1, 2]
x2 = [1, 2]
print(np.add(x1, x2))
# [2, 4]
x = np.random.randint(2, size=10)
x = np.append(x, 2)
x1 = [1, 2]
x2 = [1, 2]
print(np.add(x1, x2))
# [2, 4]