【发布时间】:2019-01-28 10:48:10
【问题描述】:
我正在尝试提取包含在
的表中https://www.timeanddate.com/weather/netherlands/amsterdam/historic?month=8&year=2018
但是,如果我尝试简单的:
import pandas as pd
Ds=pd.read_html(r'http://www.timeanddate.com/weather/netherlands/amsterdam/historic?month=8&year=2018')
我收到以下错误:
TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('<U82') dtype('<U82') dtype('<U82').
我已经检查过了,如果我查看 html 源代码,可以看到感兴趣的表格,
<table id="wt-his" class="zebra tb-wt fw va-m tb-hover sticky-en">
如何使用 pandas 提取表格?
【问题讨论】:
-
无法在我的机器上重新创建...
-
Python 2.7.12, pd.__version__ Out[4]: u'0.20.2'
-
哦...我正在使用 Py3,pandas 0.23.0
-
我认为读取数据时存在类型问题..stackoverflow.com/questions/44527956/… ......我建议使用请求,BeautifulSoup 将使工作更轻松