【发布时间】:2022-01-05 03:21:58
【问题描述】:
我正在尝试从特定网站获取 3 个表格,但只有前两个出现。我什至尝试使用 BeautifulSoup 获取数据,但第三个似乎以某种方式隐藏。有什么我遗漏的吗?
url = "https://fbref.com/en/comps/9/keepersadv/Premier-League-Stats"
html = pd.read_html(url, header=1)
print(html[0])
print(html[1])
print(html[2]) # This prompts an error that the tables does not exist
前两个表是小队表。未显示的表是个人玩家表。来自同一网站的类似页面也会发生这种情况。
【问题讨论】:
-
最后一张表是用javascript加载的,所以在静态html中不可用
-
你需要使用类似selenium-python
标签: python python-3.x pandas dataframe web-scraping