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: []
imxitiz
  • 3,920
  • 3
  • 9
  • 33
LucaL
  • 1

0 Answers0