【问题标题】:Read pdf table like structure(not exact table) in python and extract it to any file format在python中读取类似结构的pdf表格(不是精确的表格)并将其提取为任何文件格式
【发布时间】:2020-12-28 22:57:20
【问题描述】:

我有一个 pdf 文件,其中中间的页面填满了测量值。 I 看起来像一张桌子,但与线条不完全对齐。我想以与查看 csv 或 Excel 文件相同的方式提取数据。

PDF文件数据样本:

column1 column2 column3 column4
1       0.05    2.01    3.09   
2       5.05    4.01    6.03
3       7.01    8.02    1.00

pdf 数据中没有对齐。就像它不像表中那样分开使用符号线。那么哪个模块适合使用它来导出为 Excel 或 csv?

【问题讨论】:

标签: python pdf reader


【解决方案1】:

您可以使用 textract 来实现这一点,但这也取决于文件。

  1. http://textract.readthedocs.io/en/latest/
  2. https://github.com/deanmalmgren/textract

它支持多种类型的文件,包括 PDF 文件

import textract
text = textract.process("path/to/file.pdf")

【讨论】:

  • 我可以使用许多库进行提取。但是 pdf 数据格式不太可能没有像段落这样的文本或像行分隔的表格。所以如果我提取它似乎不是表格的形式
猜你喜欢
  • 1970-01-01
  • 2018-09-27
  • 1970-01-01
  • 1970-01-01
  • 2017-04-26
  • 1970-01-01
  • 2020-09-18
  • 1970-01-01
  • 2021-07-31
相关资源
最近更新 更多