.xlsIt is not a text file, and setting the encoding should be invalid. Hold on and wait until the file is downloaded before pd.read_excel()
read_excel(io) io) io可以是 url、ftp 之类的资源定位符。 如果你知道.xlsio can be a resource locator such as url or ftp.
If you know the location , you can open it directly.
>>>help(pd.read_excel)
Help on function read_excel in module pandas.io.excel:
read_excel(io, …………)
Read an Excel table into a pandas DataFrame
Parameters
----------
io : string, path object (pathlib.Path or py._path.local.LocalPath),
file-like object, pandas ExcelFile, or xlrd workbook.
The string could be a URL. Valid URL schemes include http, ftp, s3,
and file. For file URLs, a host is expected. For instance, a local
file could be file://localhost/path/to/workbook.xlsx
🎜Try it, directly pd.read_excel(file) or (file.stream)🎜
I think stringIO can solve your problem. Use it to save the file.stream content first. Passing to pd.
.xls
It is not a text file, and setting the encoding should be invalid.Hold on and wait until the file is downloaded before pd.read_excel()
read_excel(
If you know the locationio
)io
)io
可以是 url、ftp 之类的资源定位符。如果你知道
.xls
io
can be a resource locator such as url or ftp., you can open it directly.