Skip to content

Pandas read_excel sometimes using xlrd which has deprecated code in python 3.8.1 #30851

Closed
@mhooreman

Description

@mhooreman

Hello,

Under some circumstances that I'm unable to systematically reproduce, pd.read_excel still uses xlrd.

With python 3.8, I get a DeprecationWarning, which I can't fix.

Since there is no maintainer anymore for xlrd, I must come back to you to get some advises. Would you be so kind to help me?

I'm using pd.read_excel within joblib parallel subprocesses, using the devault backend. There is no specific option given to read_excel, and I have a mix of xls and xlsx files. The "interesting part" of the exception is show below.

Unfortunately, when I try it manually using ipython interactive shell, I have no issue, even with the parallel joblib processing.

Thanks a lot.

  File "########/src/context/erpcrm_new/etl/_chunks/_base.py", line 229, in readExcel
    ret = pd.read_excel(
  File "########/.local/share/virtualenvs-_GHTURhP/lib/python3.8/site-packages/pandas/util/_decorators.py", line 208, in wrapper
    return func(*args, **kwargs)
  File "########/.local/share/virtualenvs-_GHTURhP/lib/python3.8/site-packages/pandas/io/excel/_base.py", line 310, in read_excel
    io = ExcelFile(io, engine=engine)
  File "########/.local/share/virtualenvs-_GHTURhP/lib/python3.8/site-packages/pandas/io/excel/_base.py", line 819, in __init__
    self._reader = self._engines[engine](self._io)
  File "########/.local/share/virtualenvs-_GHTURhP/lib/python3.8/site-packages/pandas/io/excel/_xlrd.py", line 21, in __init__
    super().__init__(filepath_or_buffer)
  File "########/.local/share/virtualenvs-_GHTURhP/lib/python3.8/site-packages/pandas/io/excel/_base.py", line 359, in __init__
    self.book = self.load_workbook(filepath_or_buffer)
  File "########/.local/share/virtualenvs-_GHTURhP/lib/python3.8/site-packages/pandas/io/excel/_xlrd.py", line 36, in load_workbook
    return open_workbook(filepath_or_buffer)
  File "########/.local/share/virtualenvs-_GHTURhP/lib/python3.8/site-packages/xlrd/__init__.py", line 130, in open_workbook
    bk = xlsx.open_workbook_2007_xml(
  File "########/.local/share/virtualenvs-_GHTURhP/lib/python3.8/site-packages/xlrd/xlsx.py", line 812, in open_workbook_2007_xml
    x12book.process_stream(zflo, 'Workbook')
  File "########/.local/share/virtualenvs-_GHTURhP/lib/python3.8/site-packages/xlrd/xlsx.py", line 266, in process_stream
    for elem in self.tree.iter() if Element_has_iter else self.tree.getiterator():
  File "/opt/python/3.8.1/lib/python3.8/xml/etree/ElementTree.py", line 622, in getiterator
    warnings.warn(
DeprecationWarning: This method will be removed in future versions.  Use 'tree.iter()' or 'list(tree.iter())' instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    IO Excelread_excel, to_excel

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions