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)
相关推荐
杨充19 分钟前
1.3 浮点型数据设计灵魂
开发语言·python·算法
meilindehuzi_a1 小时前
深入浅出数据结构:Python 字典(Dict)与集合(Set)的哈希表底层全链路追踪
数据结构·python·散列表
Lucas凉皮1 小时前
20243408 2025-2026-2 《Python程序设计》综合实践报告
python·实验报告
键盘上的猫头鹰1 小时前
【MySQL 教程(八)】索引、事务、用户管理、导入导出与分页查询
数据库·python·mysql
薛定谔的猫-菜鸟程序员2 小时前
2小时智能体开发一个智能体?我用CodeArts Agent 和 AtomCode 开发了一个适老化智能体。
人工智能·python·agent
bigfootyazi3 小时前
python爬虫-基本库-urllib库(常用速查)
开发语言·爬虫·python
瑶总迷弟3 小时前
使用 mis-tei 在昇腾310P上部署 bge-m3模型
pytorch·python·华为·语言模型·自然语言处理·cnn·unix
belong_my_offer3 小时前
认识到精通函数
开发语言·python
卡次卡次14 小时前
vibecoding起步注意点:插件、Skills、MCP、Hooks
服务器·数据库·python·oracle
我的xiaodoujiao5 小时前
API 接口自动化测试详细图文教程学习系列24--如何用Pytest去设计接口测试用例并执行
python·学习·测试工具·pytest