Unstructured-IO / Unstructured-IO/unstructured

Future Warning: Passing bytes to `read_excel` is deprecated

Open Beginner friendly
#4,036 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
15.5k
Forks
1.3k
Avg merge
4d 2h
Merged PRs (30d)
13

Description

Hi,

When using unstructured in a test, I get the following deprecation warning.

[redacted]/site-packages/unstructured/partition/xlsx.py:197: FutureWarning: Passing bytes to 'read_excel' is deprecated and will be removed in a future version. To read from a byte string, wrap it in a `BytesIO` object.
    return pd.read_excel(f, sheet_name=None, header=self.header_row_idx)

See: https://github.com/Unstructured-IO/unstructured/blob/c04235c16842e5be504dc7509ad2f12ea6adb43c/unstructured/partition/xlsx.py#L197

Deprecation is logged here: https://pandas.pydata.org/docs/dev/reference/api/pandas.read_excel.html

Fix should be simple: wrap f in an BytesIO object.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect unstructured/partition/xlsx.py around line 197 and trace how f is passed to pandas.read_excel. Reproduce the XLSX partitioning warning in the relevant test, then verify the warning is gone while the parsed workbook behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
data
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.