Python错误集锦:pandas读取excel提示ImportError: Missing optional dependency ‘xlrd’.

该文章已生成可运行项目,

原文链接:http://www.juzicode.com/archives/3125

 

错误提示:

用pandas read_excel()方法读取xls或xlsx文件时,提示:ImportError: Missing optional dependency ‘xlrd’. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.

import numpy as np
import pandas as pd

df = pd.read_excel('pd-test.xls')
print('df=\n',df)

命令行运行py文件提示:

Traceback (most recent call last):
  File "pd-test.py", line 4, in <module>
    df = pd.read_excel('pd-test.xls')
  File "D:\Python\Python38\lib\site-packages\pandas\util\_decorators.py", line 296, in wrapper
    return func(*args, **kwargs)
  File "D:\Python\Python38\lib\site-packages\pandas\io\excel\_base.py", line 304, in read_excel
    io = ExcelFile(io, engine=engine)
  File "D:\Python\Python38\lib\site-packages\pandas\io\excel\_base.py", line 867, in __init__
    self._reader = self._engines[engine](self._io)
  
本文章已经生成可运行项目
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值