Excel file format cannot be determined, you must specify an engine manually

Excel file format cannot be determined, you must specify an engine manually,第1张

大家在利用pandas读取excel文件的时候,一定会碰到类似的问题;这里主要写一下我踩过的坑:
#官网pandas对engine的解释
enginestr, default None
If io is not a buffer or path, this must be set to identify io. Supported engines: “xlrd”, “openpyxl”, “odf”, “pyxlsb”. Engine compatibility :

“xlrd” supports old-style Excel files (.xls).

“openpyxl” supports newer Excel file formats.

“odf” supports OpenDocument file formats (.odf, .ods, .odt).

“pyxlsb” supports Binary Excel files.

Changed in version 1.2.0: The engine xlrd now only supports old-style .xls files. When engine=None, the following logic will be used to determine the engine:

If path_or_buffer is an OpenDocument format (.odf, .ods, .odt), then odf will be used.

Otherwise if path_or_buffer is an xls format, xlrd will be used.

Otherwise if path_or_buffer is in xlsb format, pyxlsb will be used.

New in version 1.3.0.

Otherwise openpyxl will be used.

但是,我们大部分应该是下载Exel文件的时候,里面内容的格式很乱导致pandas不知道用那个engine工作,所以才会让你手动ing指定engine。这里很简单你把文件另存为相应的格式就欧克了。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/790846.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-05
下一篇 2022-05-05

发表评论

登录后才能评论

评论列表(0条)

保存