【ERROR】xlrd.biffh.XLRDError: Openoffice.org ODS file; not supported

>>> import pandas as pd
>>> import numpy as np
>>> df = pd.read_excel("excel-comp-data.xlsx")
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python2.7/dist-packages/pandas/io/excel.py", line 191, in read_excel
    io = ExcelFile(io, engine=engine)
  File "/usr/local/lib/python2.7/dist-packages/pandas/io/excel.py", line 249, in __init__
    self.book = xlrd.open_workbook(io)
  File "/usr/local/lib/python2.7/dist-packages/xlrd/__init__.py", line 428, in open_workbook
    raise XLRDError('Openoffice.org ODS file; not supported')
xlrd.biffh.XLRDError: Openoffice.org ODS file; not supported

解决方法
xlrd 是不能读取 2007的excel文件的,改成2007之后的excel文件。

如果需要处理2007格式的excel文件,推荐使用 http://packages.python.org/openpyxl/

你可能感兴趣的:(python及后端)