我试图从这个xls文件中创建一个DataFrame,但不断收到错误:
import pandas as pd
from pandas import *
xls = pd.ExcelFile('/home/nick/LA_County15K-50K.xls')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/pandas/io/excel.py", line 136, in __init__
self.book = xlrd.open_workbook(io)
File "/usr/lib/python2.7/dist-packages/xlrd/__init__.py", line 435, in open_workbook
ragged_rows=ragged_rows,
File "/usr/lib/python2.7/dist-packages/xlrd/book.py", line 91, in open_workbook_xls
biff_version = bk.getbof(XL_WORKBOOK_GLOBALS)
File "/usr/lib/python2.7/dist-packages/xlrd/book.py", line 1258, in getbof
bof_error('Expected BOF record; found %r' % self.mem[savpos:savpos+8])
File "/usr/lib/python2.7/dist-packages/xlrd/book.py", line 1252, in bof_error
raise XLRDError('Unsupported format, or corrupt file: ' + msg)
xlrd.biffh.XLRDError: Unsupported format, or corrupt file: Expected BOF record; found '\r\n '
我正在使用Linux Mint。为什么我会收到此错误,我该怎么做才能修复它以便我可以创建一个DataFrame,谢谢?