In my Python script, I load a 1D vector from a .dat file. I want to use that vector as the first column in a matrix, where the second column is filled with 1s. This is how I did it:
I am working on vectors using python script, what I am trying to do is. I am taking a vector as my first column in my matrix, my second column consists of 1s value. This is how it looks:
x = np.loadtxt( 'x.dat' )
m = x.shape[0]
X = np.concatenate((x.reshape((m,1)), np.ones((m,1))), axis=1)
Is there any other way to achieve it?