Pandas xlrd引擎传递了静止值错误

时间:2018-05-12 14:12:32

标签: python excel python-3.x pandas xlrd

我正在尝试从网址中读取xls文件:

使用请求:

page = requests.get(url) # xls url
df = pd.read_excel(page.content,engine = 'xlrd')  #engine is passed



File "f:\python36\lib\site-packages\pandas\util\_decorators.py", line 118, in wrapper
    return func(*args, **kwargs)
  File "f:\python36\lib\site-packages\pandas\io\excel.py", line 230, in read_excel
    io = ExcelFile(io, engine=engine)
  File "f:\python36\lib\site-packages\pandas\io\excel.py", line 296, in __init__
    raise ValueError('Must explicitly set engine if not passing in'
ValueError: Must explicitly set engine if not passing in buffer or path for io.

# if i put in random engine name it throws an unsupported engine error but with xlrd it throws must set engine

我尝试保存文件,然后阅读:

with open('file.xls','wb') as f:
    f.write(page.content)

df = pd.read_excel('file.xls',engine='xlrd')  #this works

编辑:

我试过传递它引发的page.text:

ValueError: embedded null character

0 个答案:

没有答案