I am trying to convert a list into an array. The list is:
list = [[59.99,
58.648,
58.608,
62.944,
51.648,
49.397,
44.766,
40.066,
35.641,
33.825,
31.112,
28.644,
26.441,
24.592,
26.767],
... ,
[253.99,
7.8,
58.28,
744.4,
59.08,
10.37,
2.9,
33.356,
64.2,
4.5,
3.18,
24,77,
7.18,
92,5,
95.87]]
I have tried this :
A = numpy.array(list)
but when I type A, I get the following array:
array([list([59.99, 58.648, 58.608, 62.944, 51.648, 49.397, 44.766, 40.066, 35.641, 33.825, 31.112, 28.644, 26.441, 24.592, 26.767]),
...,
list([253.99, 7.8, 58.28, 744.4, 59.08, 10.37, 2.9, 33.356, 64.2, 4.5, 3.18, 24,77, 7.18, 92,5, 95.87])],
dtype=object)
How can I get ride of list() in the array ?
set(map(len, L))whereLis your input list (don't shadow built-ins, i.e. call your inputLnotlist)? If your sublists are not the same length, what you see is inevitable.