本文介绍了Pandas.read_excel:不支持的格式,或文件损坏:预期的BOF记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用pandas.read_excel读取.xls文件.它在我的大多数.xls文件上都成功执行,但是对于某些错误,出现以下错误消息:

I'm trying to use pandas.read_excel to read in .xls files. It succeeds on most of my .xls files, but then for some it errors out with the following error message:

Unsupported format, or corrupt file: Expected BOF record; found '\x00\x05\x16\x07\x00\x02\x00\x00'

我一直在尝试研究为什么某些文件而不是所有文件都发生这种情况. xlrd版本是1.0.0.我尝试使用xlrd.open_workbook手动读入,但得到的结果相同.

I've been trying to research why this is happening to some, but not all files. The xlrd version is 1.0.0. I tried to manually read in with xlrd.open_workbook and I get the same result.

有人知道此BOF记录指的是哪种文件类型吗?

Does anyone know what file type, this BOF record is referring to?

推荐答案

出现该错误消息的原因有多种.但是,主要原因可能是由于Excel文件本身.有时,尤其是如果您是从某些Reporting Portal提取Excel文件时,该Excel文件可能已损坏,因此最好的办法是打开Excel文件并将其另存为新的.xls文件,然后重试运行pandas.read_excel.

There are various reasons to why that error message appeared. However, the main reason could be due to the Excel file itself. Sometimes, especially if you're pulling an Excel file from some Reporting Portal, the Excel file could be corrupt so the best thing would be to open the Excel file and save it as a new .xls file then retry running pandas.read_excel.

Lemme知道它是否有效.

Lemme know if it works.

这篇关于Pandas.read_excel:不支持的格式,或文件损坏:预期的BOF记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 03:49