Skip to content

BUG: read_html - file path cannot be pathlib.Path type #37705

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

Closed
simon-spier0 opened this issue Nov 8, 2020 · 3 comments
Closed

BUG: read_html - file path cannot be pathlib.Path type #37705

simon-spier0 opened this issue Nov 8, 2020 · 3 comments
Labels
Bug good first issue IO HTML read_html, to_html, Styler.apply, Styler.applymap

Comments

@simon-spier0
Copy link

import pandas as pd
from pathlib import Path


file_path_string = r'C:\Users\Desktop\my_file.html'
file_path = Path(file_path_string)
df1 = pd.read_html(file_path_string)[0]  # works fine
df2 = pd.read_html(file_path)[0]  # raises TypeError: cannot parse 'from WindowsPath'

Why do read_excel(), read_csv(), to_excel(), to_csv(), ... support pathlib.Path while read_html() doesn't?

@simon-spier0 simon-spier0 added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 8, 2020
@twoertwein twoertwein added IO HTML read_html, to_html, Styler.apply, Styler.applymap and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 9, 2020
@twoertwein
Copy link
Member

thanks @simon-spier0 for the report!

An easy fix would be to call stringify_path (from pandas/io/common.py) in read_html.

@twoertwein twoertwein added this to the Contributions Welcome milestone Nov 9, 2020
@inspurwusixuan
Copy link
Contributor

inspurwusixuan commented Nov 9, 2020

thanks @simon-spier0 for the report!

An easy fix would be to call stringify_path (from pandas/io/common.py) in read_html.

Hi, I'm new here and want to start my first contribution. Can I take this issue? :) @twoertwein

Thanks!

@twoertwein
Copy link
Member

@inspurwusixuan of course!

inspurwusixuan added a commit to inspurwusixuan/pandas that referenced this issue Nov 10, 2020
inspurwusixuan added a commit to inspurwusixuan/pandas that referenced this issue Nov 10, 2020
inspurwusixuan added a commit to inspurwusixuan/pandas that referenced this issue Nov 10, 2020
inspurwusixuan added a commit to inspurwusixuan/pandas that referenced this issue Nov 10, 2020
inspurwusixuan added a commit to inspurwusixuan/pandas that referenced this issue Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug good first issue IO HTML read_html, to_html, Styler.apply, Styler.applymap
Projects
None yet
Development

No branches or pull requests

3 participants