#-*- coding: utf-8 -*-
import pandas as pd
inputfile = './electricity_data_analyze.xls'
outputfile = './electricity_data.xls'
data = pd.read_excel(inputfile)
data[u'线损率'] = data[u'线损率'].str.strip('%').astype(float)/100 #Series.astype()将对象类型转化为指定的类型
data.to_excel(outputfile, index=False)
百分数数据:
转化后的小数数据: