python ‘could not convert string to float: ''’错误情况

请问这个如何解决,求帮助!wwwwwwwwwwwwwww,python

img

是有空值,用判断语句剔除一下即可:

import csv
with open('st1.csv',encoding='utf-8') as f:
    csv_reader=csv.reader(f)
    next(csv_reader)
    for row in csv_reader:
        print([float(x) if x!='' else '' for x in row[1:] ])

在这句前,加一行
print(row[5:9])
看看有啥

还是有空的字符串

应该x不完全是一个能转化成float的str

切片处理一下试试