I want to concatenate three 1 dimensional numpy arrays (x1, x2, x3) to one array X (3 columns). I already tried the concatenate function but I think I am doing something wrong. At least I got an error message:
I tried the following:
X = np.concatenate([x1, x2, x3], axis = 1)
As well as:
X = np.concatenate((x1, x2, x3), axis = 1)
Both times I got an error:
Error: IndexError: axis 1 out of bounds [0, 1)
How to use the concatenate function correct? Or is there a better way to do it?
axis=1. You have to to turn the arrays into 2d first. That's what all the answers do before usingconcatenate.