Bha*_*ttu 3 xlrd xlsx python-3.x pandas
我有一个文件试图使用 Pandas.read_excel 打开。我收到这样的错误 -
无效文件:
InMemoryUploadedFile:file.xlsx(application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
首先,您需要使用 xlrd 打开文件,然后使用参数 engine="xlrd" 将结果传递给 pandas.read_excel
import pandas as pd
import xlrd
book = xlrd.open_workbook(file_contents=myfile)
df = pd.read_excel(book,engine='xlrd')
print(df.head())
Run Code Online (Sandbox Code Playgroud)
这里的“myfile”是你的内存文件
| 归档时间: |
|
| 查看次数: |
3375 次 |
| 最近记录: |