I have some lists that I want to convert into a 2D numpy array.
list1 = [ 2, 7 , 8 , 5]
list2 = [18 ,29, 44,33]
list3 = [2.3, 4.6, 8.9, 7.7]
The numpy array I want is:
[[ 2. 18. 2.3]
[ 7. 29. 4.6]
[ 8. 44. 8.9]
[ 5. 33. 7.7]]
which I can get by typing the individual items from the list directly into the numpy array expression as np.array(([2,18,2.3], [7,29, 4.6], [8,44,8.9], [5,33,7.7]), dtype=float)
.
But I want to be able to convert the lists into the desired numpy array.