python - Python,将html表转换为数据框
问题描述
我正在尝试使用 parser.make2d 函数将我的 html 表转换为可用的数据框,但我无法安装 parser.make2d 的模块。在我的 python 2.7 中,它找不到“html_table_parser”模块,因此“from html_table_parser import parser_functions as parse”不起作用。
from urllib2 import urlopen
import pandas as pd
from bs4 import BeautifulSoup
import webbrowser
import requests
from html_table_parser import parser_functions as parse
report = requests.get(url_parsing, proxies = proxies)
report2 = BeautifulSoup(report.text,'html.parser')
body=report2.find("body")
table=body.find_all("table")
p = parser.make2d(table[3])
解决方案
似乎没有安装 html_table_parser 模块。
你试过跑步吗
python -m pip install html_table_parser
在命令行上?
推荐阅读
- node.js - InfluxDB 写入失败节点-influx 库
- python - 试图通过 python 控制 DGH D8500 modbus
- php - 在 Wordpress 中注销脚本似乎是不可能的
- asp.net-core - 如果我使用 OnInitializedAsync 方法,页面初始化时出现 NullReferenceException
- angular - 不断获得未捕获(承诺):错误:模板解析错误:“组件”不是已知元素:
- c++ - 我想用“cout”命令慢慢打印文本,但我真的找不到任何解决方案
- python - 如果一行包含特定字符串,熊猫有没有办法在新列中创建一个整数
- javascript - 如何在 VueJS 中添加自定义排序?
- javascript - 将键数组转换为键值对对象
- javascript - 使用 Javascript 在隐藏和可见文本之间切换