Trying to load data from a csv file.
There's an object in file as follows:
[13 12 12 13 12 12]
dtype('O')
as shown when I tried object'.values.dtype
how to convert to numeric list?
Tried astype(str)
, not working either.
Trying to load data from a csv file.
There's an object in file as follows:
[13 12 12 13 12 12]
dtype('O')
as shown when I tried object'.values.dtype
how to convert to numeric list?
Tried astype(str)
, not working either.
Assuming you have that as a string then:
s = '[13 12 12 13 12 12]'
print([int(x) for x in s[1:-1].split()])
Output:
[13, 12, 12, 13, 12, 12]