Pandas读取excel异常

python 复制代码
Pandas 处理excel异常: ValueError: Excel file format cannot be determined, you must specify an engine manually.

今天使用pandas 处理excel的时候,抛出异常:ValueError: Excel file format cannot be determined, you must specify an engine manually. 异常的内容是:无法确定Excel文件格式,需要手动指定引擎, 运行结果看下图

python 复制代码
df_all = pd.read_excel("./result.xls")
print(df_all.columns)

因为我在使用pandas的时候没有写engine的习惯,所以我就直接加上 engine='openpyxl' 运行结果见下图

python 复制代码
df_all = pd.read_excel('./result.xls', engine='openpyxl')
print(df_all.columns)

运行后继续抛出异常 zipfile.BadZipFile: File is not a zip file 意思就是 zipfile.BadZipFil: File不是zip文件, 这里我能想到的就是xls的文件格式应该是有问题,我打开xls文件然后另存为xlsx文件后 就可以正常运行了, 运行结果见下图

python 复制代码
df_all = pd.read_excel("./result.xlsx")
print(df_all.columns)
相关推荐
m0_7482522331 分钟前
Python 入门教程(2)搭建环境 2.4、VSCode配置Node.js运行环境
vscode·python·node.js
梓羽玩Python1 小时前
太牛了!OWL:Manus 最强开源复现,开源框架GAIA基准测试中排第一!
人工智能·python
2301_764441331 小时前
python实现的生态模拟系统
开发语言·python·pygame
m0_748241701 小时前
Python毕业设计选题:基于django+vue的智能租房系统的设计与实现
python·django·课程设计
m0_748244961 小时前
Python毕业设计选题:基于Python的社区爱心养老管理系统设计与实现_django
python·django·课程设计
莓事哒1 小时前
静态网页的爬虫(以电影天堂为例)
爬虫·python
HerrFu1 小时前
可狱可囚的爬虫系列课程 18:成都在售新房数据爬虫(lxml 模块)实战
爬虫·python
m0_748236581 小时前
Python数据分析案例30——中国高票房电影分析(爬虫获取数据及分析可视化全流程)
爬虫·python·数据分析
datacollectionspecia1 小时前
如何使用Scrapeless抓取Google Lens结果
python
五张1 小时前
3D码农建模 - 正多面体
python