How to convert String into integers in python sickit-learn -
this question has answer here:
- convert strings in list int [duplicate] 2 answers
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
Post a Comment