成功解决ValueError: Number of passed names did not match number of header fields in the file

成功解决ValueError: Number of passed names did not match number of header fields in the file


解决问题

ValueError: Number of passed names did not match number of header fields in the file

解决思路

值错误:传递的名称数量与文件中头字段的数量不匹配!

解决方法

使用names参数时,类似重命名。切记,要与原数据全部匹配:即不能多也不能少,多或者少都会抛出ValueError错误,所以,只需要补全所有的列标题名即可!

names=['roomtype','height','direction','decorate','garden','district','total_price_Num','area_Num'],

改为

names=['','roomtype','height','direction','decorate','garden','district','total_price_Num','area_Num'],
(0)

相关推荐