I want to simply assign 1 into all list of a ndarray.
before,
[5.2 4.1]
[6.9 3.1]
[5.9 3.2]
[5.6 2.8]
[6.7 3.3]......................
what i need,
[1 5.2 4.1]
[1 6.9 3.1]
[1 5.9 3.2]
[1 5.6 2.8]
[1 6.7 3.3]
i am trying to iterate and insert, then try to assign the returned value. but i have a problem with the shape. found the above error.
for i in range(len(X_train)):
X_train[i] = np.insert(X_train[i], 0,1)
then i tried to reshape before loop:
X_train = X_train.reshape(len(X_train), 3)
i found this error: cannot reshape array of size 210 into shape (105,3)
but the actual shape:
>>X_train.shape
output: (105, 2)
I am looking for any solution and also the reason. thanks in advance.