美文网首页
错误 pandas pd.read_excel() error

错误 pandas pd.read_excel() error

作者: 波洛的汽车电子世界 | 来源:发表于2022-05-17 11:08 被阅读0次

问题:

用Pandas读.xlsx时候出现错误:

XLRDError: Excel xlsx file; not supported

解决方法:

  • 方法1:xlrd库只支持xls文件,不支持xlsx文件。如果要处理xlsx文件,可以安装openpyxl库。
    (用Jupyter Lab或者notebook的一定要记得重启notebook来reload pandas, 我就是忘做这一步怎么导入都出错)

  • 方法2:update pandas
    Pandas 1.3.1以上

  • 方法3:在读文件的时候,设置好engine

pd.read_excel('my.xlsx', engine='openpyxl')

相关文章

网友评论

      本文标题:错误 pandas pd.read_excel() error

      本文链接:https://www.haomeiwen.com/subject/eczgurtx.html