'How to use Pandas read HTML [duplicate]

I want to create a dataframe from a HTML table but with the code I have right now it does not work. Can anyone help me?

url = 'https://www.sportsmole.co.uk/football/premier-league/table.html'
df = pd.read_html(url)
print(df.head())


Solution 1:[1]

pd.read_html returns a list of dataframes, you may do

dfs = pd.read_html(url)
print(dfs[0].head())

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ynjxsjmh