list1
is a list
that contains 1 element that is an numpy.array
that contains multiple floats64
.
list2
is list
that contains 1 element that is a list
that contains multiple
strings
(that happen to look a lot like floats
).
You can convert them like so:
import numpy as np
# list of list of strings that look like floats
list2 = [['-0.03803351', '0.07370875', '0.03514577', '-0.07568369', '-0.07438357']]
# list of np.arrays that contain float64's
data = list([np.array(list(map(np.float64, list2[0])))]) # python 3.x
print(data)
print(type(data))
print(type(data[0]))
print(type(data[0][0]))
Output:
[array([-0.03803351, 0.07370875, 0.03514577, -0.07568369, -0.07438357])]
<type 'list'>
<type 'numpy.ndarray'>
<type 'numpy.float64'>
4
solved What is the difference between the lists