Der Code ist der folgende:
Code: Select all
import requests
import pandas as pd
from bs4 import BeautifulSoup
url = "https://fbref.com/it/comp/11/gca/Statistiche-di-Serie-A#all_stats_gca"
response = requests.get(url)
soup = BeautifulSoup(response.content, 'html.parser')
table = soup.find('table', {'id': 'stats_gca'})
df = pd.read_html(str(table))[0]
print(df)
Was mache ich falsch?
Ich habe es auch versucht, indem ich nicht Pandas, sondern die verwendet habe Ergebnis ist das gleiche. Ich gehe davon aus, dass ich etwas verpasst habe.
Mobile version