pd.read_html() imports a list rather than a dataframe

.read_html() produces a list of dataframes (there could be multiple tables in an HTML source), get the desired one by index. In your case, there is a single dataframe:

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

Note that, if there are no tables in the HTML source, it would return an error and would never produce an empty list.

Leave a Comment