Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FutureWarning: Passing literal html to 'read_html' is deprecated and will be removed in a future version #55

Closed
esqew opened this issue Oct 19, 2023 · 0 comments · Fixed by #56
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@esqew
Copy link
Collaborator

esqew commented Oct 19, 2023

The latest run of our test cases has highlighted that the current paradigm we use to pass raw HTML from mechanicalsoup to a pandas' DataFrame structure is in the process of being deprecated as of [email protected], and some warnings are now being thrown as a result when using a pandas version >= 2.1.0:

Deprecated since version 2.1.0: Passing html literal strings is deprecated. Wrap literal string/bytes input in io.StringIO/io.BytesIO instead.

Source

This will necessitate a small change to several lines in the current codebase, namely:

While I can't say I'm quite up to speed on what the rationale for this change is, the fix itself should be particularly easy even when considering backwards compatibility for Python versions >= 3.8 for which we currently test compatibility, since io.StringIO has been available in Python core since pre-3.x. Using conference.py:63 as an example, its fixed version would become:

from io import StringIO
# ...
conf_df = pd.read_html(StringIO(str(table)))[0]
@esqew esqew added bug Something isn't working good first issue Good for newcomers labels Oct 19, 2023
@esqew esqew self-assigned this Oct 19, 2023
esqew added a commit that referenced this issue Oct 19, 2023
esqew added a commit that referenced this issue Oct 19, 2023
esqew added a commit that referenced this issue Oct 19, 2023
esqew added a commit that referenced this issue Oct 19, 2023
@esqew esqew linked a pull request Oct 19, 2023 that will close this issue
@esqew esqew closed this as completed in #56 Oct 20, 2023
esqew added a commit that referenced this issue Oct 20, 2023
HTML string literal FutureWarning fixes (closes #55)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant