Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python cast list to float

import numpy as np
test = "5,4,3,2"; 
lst = test.split(",");#lst is list of strings
a = np.array(lst,dtype=np.float32) #convert to numpy array of floats
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #cast #list #float
ADD COMMENT
Topic
Name
1+2 =