表格解析调研

表格解析调研

TextInTools

TextInTools:https://tools.textin.com/table

可以将表格图片解析成可编辑的表格/json,效果不错

白描

地址:https://web.baimiaoapp.com/image-to-excel

可以将表格图片识别成可编辑的表格,可复制、导出为xlsx、txt。效果不错,但是免费有额度

i2PDF

地址:https://www.i2pdf.com/cn/extract-tables-from-pdf

可以对pdf进行多种处理,提取表格效果不错,并且可以选择导出的格式,效果不错

Tabula-PDF

项目地址:https://github.com/tabulapdf/tabula

用于从PDF文档中识别和提取表格数据。它利用机器学习算法和计算机视觉技术,能够准确地识别PDF页面中的表格,并将其转换为结构化数据。Tabula-PDF会将识别到的表格转换为结构化数据,如CSV、Excel、json等格式。效果一般

pdflux

项目地址:https://pdflux.com/

效果不错,会有免费额度

iLoveOCR

地址:https://cn.iloveocr.com/

效果一般

ocr2edit

地址:https://www.ocr2edit.com/zh

识别效果不好

py代码

使用python-docx库

python代码实现将word中的表格解析出来

python 复制代码
from docx import Document

doc = Document('example.docx')
for table in doc.tables:
    for row in table.rows:
        cells = [cell.text for cell in row.cells]
        print(cells)

使用PyMuPDF

需要安装PyMuPDF,可以用来提取pdf内容,并且可以查找页面的表格。效果不错

python 复制代码
import fitz

doc = fitz.open('../example.pdf')
page = doc[2]  # 下标从0开始
tables = page.find_tables()
df = tables[1].to_pandas()

df.to_excel('table.xlsx', index=False)

使用pdfplumber库

使用pdfplumber实现将pdf中的表格解析出来,效果一般,示例代码如下:

python 复制代码
import pdfplumber
import pandas as pd

with pdfplumber.open("../example.pdf") as pdf:
    page = pdf.pages[3]
    for table in page.extract_tables():
        df = pd.DataFrame(table[1:], columns=table[0])
        df.to_excel('table.xlsx', index=False)

使用camelot库

camelot专门用于从 PDF 文件中提取表格数据。效果不错

python 复制代码
import camelot

tables = camelot.read_pdf('../example.pdf')

tables.export('result.csv', f='csv', compress=True) # json, excel, html, markdown, sqlite

print(tables[0].parsing_report)

tables[0].to_csv('result.csv') # to_json, to_excel, to_html, to_markdown, to_sqlite
相关推荐
ujainu14 分钟前
让笔记触手可及:为 Flutter + OpenHarmony 鸿蒙记事本添加实时搜索(二)
笔记·flutter·openharmony
yunsr15 分钟前
python作业3
开发语言·python
历程里程碑17 分钟前
普通数组-----除了自身以外数组的乘积
大数据·javascript·python·算法·elasticsearch·搜索引擎·flask
曦月逸霜17 分钟前
Python快速入门——学习笔记(持续更新中~)
笔记·python·学习
喵手19 分钟前
Python爬虫实战:采集菜谱网站的“分类/列表页”(例如“家常菜”或“烘焙”频道)数据,构建高可用的美食菜谱数据采集流水线(附CSV导出)!
爬虫·python·爬虫实战·零基础python爬虫教学·采集菜谱网站数据·家常菜或烘焙频道·构建高可用食谱数据采集系统
喵手21 分钟前
Python爬虫实战:硬核解析 Google Chrome 官方更新日志(正则+文本清洗篇)(附 CSV 导出)!
爬虫·python·爬虫实战·零基础python爬虫教学·csv导出·监控谷歌版本发布历史·获取稳定版更新日志
Gain_chance22 分钟前
37-学习笔记尚硅谷数仓搭建-ADS层分析并以各品牌商品下单统计为例
笔记·学习
小邓睡不饱耶23 分钟前
实战|W餐饮平台智能化菜品推荐方案(含Spark实操+算法选型+完整流程)
python·ai·ai编程·ai写作
草莓熊Lotso25 分钟前
Qt 主窗口核心组件实战:菜单栏、工具栏、状态栏、浮动窗口全攻略
运维·开发语言·人工智能·python·qt·ui
aiguangyuan29 分钟前
基于BiLSTM-CRF的命名实体识别模型:原理剖析与实现详解
人工智能·python·nlp