I have some values is csv file and In csv file some values are numeric and some are string number. Example of csv file:
1,"1151226468812.22",100,1,467,999.00,999.95,15,1,999.00,999.95,998.50,999.95,15,999.01,1396,34,06092016091501.444,1394627.25 2,"1151226468812.11",100,1,467,999.00,1000.00,1605,3,999.00,1000.00,998.50,1000.00,5,999.03,1426,37,06092016091502.111,1424626.50 So I wnated to convert string to float. So here is my code:
datareader = csv.reader(datafile, delimiter=",", quoting= csv.QUOTE_NONE) names = [] names.append("local_timestamp") names.append("nse_timestamp") for row in datareader: data = dict() data.update(local_timestamp = row[0]) data.update(nse_timestamp = float(row[1])) But it return value error.
ValueError: could not convert string to float: '"1151226468812.22"'