Skip to content

DOC: #54822

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
1 task done
idealcrouch opened this issue Aug 28, 2023 · 6 comments · Fixed by #54859
Closed
1 task done

DOC: #54822

idealcrouch opened this issue Aug 28, 2023 · 6 comments · Fixed by #54859
Labels
Docs Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@idealcrouch
Copy link
Contributor

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/docs/user_guide/io.html#io-read-html

Documentation problem

This script in the documentation returns an error since the source material changed on Wikipedia.

import pandas pd
url_mcc = "https://en.wikipedia.org/wiki/Mobile_country_code"
dfs = pd.read_html(
    url_mcc,
    match="Telekom Albania",
    header=0,
    converters={"MNC": str},
)

returns the error
ValueError: No tables found matching pattern 'Telekom Albania'

Suggested fix for documentation

I believe the fix is to simply match on a different table name (not Telekom Albania). Even using "Albania" works for me.

import pandas as pd
url_mcc = "https://en.wikipedia.org/wiki/Mobile_country_code"
dfs = pd.read_html(
    url_mcc,
    match="Albania",
    header=0,
    converters={"MNC": str},
)
@idealcrouch idealcrouch added Docs Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 28, 2023
@DavidToneian
Copy link
Contributor

Hi idealcrouch,

thanks for reporting this!

Your fix would indeed work, but the example may break again if the contents of the page would change in certain ways, e.g., Albania changed their name.

How about fixing the referenced version of the page instead to a known-working state, e.g. https://en.wikipedia.org/wiki/Mobile_country_code?oldid=899173761?

Would you like to open a PR for this?

@thiagogquinto
Copy link
Contributor

thiagogquinto commented Aug 28, 2023

Hey @DavidToneian, could I make the PR, if I am correct, this is the location of the file, so could I make your suggested change and make a PR or do you prefer to wait for the @idealcrouch's response?

@DavidToneian
Copy link
Contributor

As far as I'm concerned, feel free to create the PR, @thiagogquinto! The location you identified is correct.

@idealcrouch
Copy link
Contributor Author

idealcrouch commented Aug 29, 2023 via email

@thiagogquinto
Copy link
Contributor

Thanks @idealcrouch, but you can make it, It's your issue.

@idealcrouch
Copy link
Contributor Author

idealcrouch commented Aug 29, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants