-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DEPR: Remove literal string input for read_html #53805
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
DEPR: Remove literal string input for read_html #53805
Conversation
@mroeschke PR is ready for inspection! |
doc/source/whatsnew/v2.1.0.rst
Outdated
@@ -298,13 +298,15 @@ Deprecations | |||
- Deprecated constructing :class:`SparseArray` from scalar data, pass a sequence instead (:issue:`53039`) | |||
- Deprecated falling back to filling when ``value`` is not specified in :meth:`DataFrame.replace` and :meth:`Series.replace` with non-dict-like ``to_replace`` (:issue:`33302`) | |||
- Deprecated literal json input to :func:`read_json`. Wrap literal json string input in ``io.StringIO`` instead. (:issue:`53409`) | |||
- Deprecated literal string/bytes input to :func:`read_html`. Wrap literal string/bytes input in ``io.StringIO`` instead. (:issue:`53767`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Deprecated literal string/bytes input to :func:`read_html`. Wrap literal string/bytes input in ``io.StringIO`` instead. (:issue:`53767`) | |
- Deprecated literal string/bytes input to :func:`read_html`. Wrap literal string/bytes input in ``io.StringIO``/``io.BytesIO`` instead. (:issue:`53767`) |
pandas/io/html.py
Outdated
@@ -1178,6 +1183,15 @@ def read_html( | |||
|
|||
io = stringify_path(io) | |||
|
|||
if isinstance(io, str) and "\n" in io: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is \n
a reliable way detect if it's literal html?
pandas/io/html.py
Outdated
@@ -1178,6 +1185,15 @@ def read_html( | |||
|
|||
io = stringify_path(io) | |||
|
|||
if isinstance(io, str) and not is_file_like(io) and "\n" in io: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use the same type of checks like in the xml PR and remove the \n
check?
@mroeschke PR is ready for inspection. |
Thanks @rmhowe425 |
* Updating documentation and adding deprecation logic for read_html. * Fixing formatting errors * Fixing documentation errors * Updating deprecation logic and documentation per reviewer recommendations. * Updating implementation per reviewer recommendations.
See: pandas-dev/pandas#53805 Passing html literal strings is deprecated. Wrap literal string/bytes input in ``io.StringIO``/``io.BytesIO`` instead.
See: pandas-dev/pandas#53805 Passing html literal strings is deprecated. Wrap literal string/bytes input in ``io.StringIO``/``io.BytesIO`` instead.
read_excel
,read_html
, andread_xml
#53767doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.