You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Pandas读取Excel文件报错:BookView.__init__()遇意外参数'WindowWidth'

解决Pandas读取Excel时BookView.__init__() got an unexpected keyword argument 'WindowWidth'错误

这个错误是由于pandas与openpyxl版本不兼容导致的:openpyxl在新版本中移除了WindowWidth参数,但旧版pandas仍会尝试传递该参数。以下是几种可行的解决办法:

  • 升级pandas到兼容版本
    执行命令更新pandas,使其适配新版openpyxl的API:

    pip install --upgrade pandas
    
  • 降级openpyxl至支持该参数的旧版本
    如果不想升级pandas,可安装兼容的openpyxl旧版本,比如3.0.10:

    pip install openpyxl==3.0.10
    
  • 更换Excel读取引擎
    读取文件时指定其他兼容的引擎:

    • 若文件为.xls格式,使用xlrd引擎(需先确保安装xlrd:pip install xlrd):
      arquivo = pd.read_excel(path, engine='xlrd')
      
    • 若文件为.xlsx格式,可尝试pyxlsb引擎(先安装:pip install pyxlsb):
      arquivo = pd.read_excel(path, engine='pyxlsb')
      

内容的提问来源于stack exchange,提问作者Vinicius

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.08 23:10:44