cancry 发表于 2022-8-15 14:49:29

关于pandas合并表格,object of type 'float' has no len()

#拆分表格
import pandas as pd
data = pd.read_excel('源数据.xlsx',sheet_name='sheet1',header=2,index_col='序号',
                                                dtype={'预算单位名称':str,'序号':str})
department = list(data['部门名称'].unique())
newdata = pd.ExcelWriter('合并.xlsx')
for i in department:
        df = data==i]
        df.to_excel(newdata,sheet_name=i,index=None')
newdata.save()
运行提示
data object of type 'float' has no len()

表格就是
序号   部门名称    项目名称项目金额(浮点数)

cancry 发表于 2022-8-15 14:59:33

请教各位大神!!!!!!!!!
页: [1]
查看完整版本: 关于pandas合并表格,object of type 'float' has no len()