Jumat, 24 Maret 2017

How to append vector in numpy

These values are appended to a copy of arr. It must be of the correct shape (the same shape as arr, excluding axis), 







import numpy as np

a = np.array([[1,2,3],[4,5,6]])
b = np.array([7,8,9])
c = np.vstack((a,b))
print c


a = np.array([[1,2,3],[4,5,6]])
b = np.array([7,8])
b = b.reshape(np.size(b),1)
c = np.hstack((a,b))
print c 

Posting Komentar