0

I want to read the weapons table in this page and convert it into a Pandas DataFrame.

I am trying with pandas.read_html() function but it returns only the table header and only the first column title is returned. I also tested with other stuff like BeautifulSoup with no results.
The problem is similar to the one posted here, except for the fact that the proposed solution (using the flavor input of pandas.read_html()) does not work in my case.

Here is my code:

from urllib.request import urlopen
import pandas as pd
import ssl
#----#
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
#----#
my_url = 'https://ps2.fisu.pw/player/?name=nixogimpo&show=weapons'
#----#
my_html = urlopen(my_url, context=ctx).read()
#----#
df = pd.read_html(str(my_html)) # flavor = "html5lib", "bs4", "lxml" does not fix
#----the table i need is the one with index 2
print(df[2])

Here is the output I am getting:

Empty DataFrame
Columns: [Weapon]
Index: []
3
  • Looks like the data is loaded dynamically. You could try Selenium Commented May 8, 2022 at 21:26
  • thanks for the hint, i'll take a look at it and see what i can get Commented May 9, 2022 at 11:37
  • 1
    by using the code found in your link i managed to read my table, many thanks @RJAdriaansen !!! Commented May 9, 2022 at 17:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.