问题:
用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')