2024-09-29 23:19:40 发布
网友
我想复制表(id=symbolMarket)并将其保存为pandas dataframe,保存在这个链接https://www.myfxbook.com/en/forex-market/currencies/US30-historical-data
请问我应该怎样用简单/漂亮的方式来做?在
显然,我可以逐个检索元素,但我相信有更好的方法。在
(如果有帮助,我使用selenium访问页面)
非常感谢与我分享知识
我很犹豫是否要发表这篇文章,因为它非常基础,而且有很多解决方案展示了如何将html表读入pandas数据帧。让我想知道你是不是想先查一下。在
但是,只要使用.read_html()。这将返回一个数据帧列表。因此,您只需找出您想要的列表中的哪个数据帧:
.read_html()
import pandas as pd url = 'https://www.myfxbook.com/en/forex-market/currencies/US30-historical-data' tables = pd.read_html(url)
输出:
我很犹豫是否要发表这篇文章,因为它非常基础,而且有很多解决方案展示了如何将html表读入pandas数据帧。让我想知道你是不是想先查一下。在
但是,只要使用
.read_html()
。这将返回一个数据帧列表。因此,您只需找出您想要的列表中的哪个数据帧:输出:
^{pr2}$相关问题 更多 >
编程相关推荐