I\'ve got this code:
import pandas as pd
import requests
from bs4 import BeautifulSoup
res = requests.get(\"https://www.bankier.pl/gielda/notowania/akcje\")
From the pandas.read_html documentation: Read HTML tables into a list of DataFrame objects.
So, df
is a list of dataframes. If you expect to only have one, it may be safe for you to use df[0].to_excel...
pd.read_html
returns a list of dataframes, you need to use an indexer to get the first dataframe.
Use:
df = pd.read_html(str(table))[0]