I've got 2 numpy arrays x1 and x2. Using python 3.4.3
x1 = np.array([2,4,4])
x2 = np.array([3,5,3])
I would like to a numpy array like this:
[[2,3],[4,5],[4,3]]
How would i go about this?
You can use numpy.column_stack:
In [40]: x1 = np.array([2,4,4])
In [41]: x2 = np.array([3,5,3])
In [42]: np.column_stack((x1, x2))
Out[42]:
array([[2, 3],
[4, 5],
[4, 3]])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With