t = ["3.4","7","","-1.3","-5",""]
How to convert this list into integer and float for further ananlysis?
I have done this so far but i got error.
t = ["3.4","7","","-1.3","-5",""]
def integer_float(string):
try:
return int(string)
except ValueError:
return float(string)
for i in t:
integer_float(i)
I got the error
ValueError: could not convert string to float: