【问题标题】:pd.read_html not reading any table from a websitepd.read_html 未从网站读取任何表格
【发布时间】: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 将使工作更轻松

标签: python html pandas


【解决方案1】:

无法生产,使用 python3。

【讨论】:

  • 那么这可能很有趣:)
猜你喜欢
  • 1970-01-01
  • 2018-08-27
  • 2020-12-21
  • 2020-06-29
  • 2021-07-01
  • 2015-06-05
  • 2019-01-16
  • 1970-01-01
相关资源
最近更新 更多