How to convert String into integers in python sickit-learn -


this question has answer here:

i have list above:

probs= ['2','3','5','6'] 

and want convert string numeric values following result:

resultat=[2, 3, 4, 5, 6] 

i tried solutions appearing on link: how convert strings integers in python? such one:

new_list = list(list(int(a) in b) b in probs if a.isdigit()) 

but didn't work, can me adapt function on data structure, thankful.

>>> probs= ['2','3','5','6'] >>> probs= map(int, probs) >>> probs [2, 3, 5, 6] 

or (as commented):

>>> probs= ['2','3','5','6'] >>> probs = [int(e) e in probs] >>> probs [2, 3, 5, 6] >>>  

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -