series值为str,全部转化为float

1、构造函数format:将单个变量从str转为float

def format(value):
value = float(value)
return value

2、用apply函数将format应用于series所有的值

data.apply(format)

posted @ 2019-12-04 10:28  jiujiuni  阅读(3412)  评论(0)    收藏  举报