My problem is that I've got this array:
np.array([0.0, 0.0, -1.2, -1.2, -3.4, -3.4, -4.5, -4.5])
and I want to convert the elements to array like this:
np.array([[0.0], [0.0], [-1.2], [-1.2], [-3.4], [-3.4], [-4.5], [-4.5]])
So is there a loop or a numpy function that I could use to do this task?
Or simply:
arr[:,None]
# array([[ 0. ],
# [ 0. ],
# [-1.2],
# [-1.2],
# [-3.4],
# [-3.4],
# [-4.5],
# [-4.5]])
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