我从pandas使用read_excel命令收到错误。我正在尝试导入.xls文件,但出现此错误。当我尝试使用ExcelFile命令时也会发生这种情况。有趣的是,我在运行相同代码的虚拟机上未收到错误。是熊猫的安装方式吗?
该错误是在我的台式机Python 3.6版本上,我的虚拟机运行3.7
错误如下:
Traceback (most recent call last):
File "G:\SHARED\Accounts Receivable\First Payment Defaults\Build\First Payment Defaults.py", line 27, in <module>
headers = pd.ExcelFile(r"\\sfcfile-2\DataModule\IL\leasing.contract.extract.new headers.xlsx")
File "C:\Program Files\Python36\lib\site-packages\pandas\io\excel.py", line 394, in __init__
self.book = xlrd.open_workbook(self._io)
File "C:\Program Files\Python36\lib\site-packages\xlrd\__init__.py", line 141, in open_workbook
ragged_rows=ragged_rows,
File "C:\Program Files\Python36\lib\site-packages\xlrd\xlsx.py", line 808, in open_workbook_2007_xml
x12book.process_stream(zflo, 'Workbook')
File "C:\Program Files\Python36\lib\site-packages\xlrd\xlsx.py", line 265, in process_stream
meth(self, elem)
File "C:\Program Files\Python36\lib\site-packages\xlrd\xlsx.py", line 392, in do_sheet
sheet = Sheet(bk, position=None, name=name, number=sheetx)
File "C:\Program Files\Python36\lib\site-packages\xlrd\sheet.py", line 326, in __init__
self.extract_formulas = book.extract_formulas
AttributeError: 'Book' object has no attribute 'extract_formulas'