Skip to content

Wrap raw HTML in StringIO for pd.read_html (#726)#742

Closed
SaguaroDev wants to merge 1 commit intocasact:mainfrom
SaguaroDev:fix/726-stringio-wrap-read-html
Closed

Wrap raw HTML in StringIO for pd.read_html (#726)#742
SaguaroDev wants to merge 1 commit intocasact:mainfrom
SaguaroDev:fix/726-stringio-wrap-read-html

Conversation

@SaguaroDev
Copy link
Copy Markdown

Closes #726.

Summary

pd.read_html() on pandas 3.0 no longer accepts literal HTML strings; they must be wrapped in io.StringIO. On pandas 2.x this currently emits:

FutureWarning: Passing literal html to 'read_html' is deprecated and will be
removed in a future version. To read from a literal string, wrap it in a
'StringIO' object.

A repo-wide search confirmed chainladder/core/tests/test_triangle.py::test_repr is the only call site passing raw HTML, so the fix is a single-line change. io was already imported in the file.

Verification

$ uv run pytest chainladder/core/tests/test_triangle.py::test_repr -W error::FutureWarning
2 passed
$ uv run pytest chainladder/core/tests/test_triangle.py
141 passed, 8 xfailed

Reference

pandas 3.0 removes support for passing literal HTML strings to
pd.read_html(); they must be wrapped in io.StringIO. The test_repr
test in chainladder/core/tests/test_triangle.py was the only place
in the codebase passing raw HTML, and currently emits a FutureWarning
on pandas 2.x.

Closes casact#726
@genedan
Copy link
Copy Markdown
Collaborator

genedan commented May 7, 2026

Hi @SaguaroDev, this edit was already made in #729, which handles #664 along with its sub-issues. You're welcome to try solving any unassigned issues outside of #664 and its sub-issues, though.

@genedan genedan closed this May 7, 2026
@SaguaroDev
Copy link
Copy Markdown
Author

Thanks @genedan — apologies for the duplicate, I missed #729 when scouting. Closing this in favor of the bundled fix there. Will look for unassigned issues outside the #664 tree.

@SaguaroDev SaguaroDev deleted the fix/726-stringio-wrap-read-html branch May 7, 2026 15:09
@kennethshsu
Copy link
Copy Markdown
Collaborator

Thanks @SaguaroDev, and excellent attempt on your first PR! Welcome to the group! We look forward to your contributions!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrap raw HTML in StringIO

3 participants