Let’s say I have a NumPy array, a:
a
a = np.array([ [1, 2, 3], [2, 3, 4] ])
And I would like to add a column of ze
In my case, I had to add a column of ones to a NumPy array
X = array([ 6.1101, 5.5277, ... ]) X.shape => (97,) X = np.concatenate((np.ones((m,1), dtype=np.int), X.reshape(m,1)), axis=1)
After X.shape => (97, 2)
array([[ 1. , 6.1101], [ 1. , 5.5277], ...