300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > Excel file format cannot be determined you must specify an engine manually

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

时间:2019-09-25 12:06:47

相关推荐

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

大家在利用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。这里很简单你把文件另存为相应的格式就欧克了。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。