- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个工作脚本,我们必须在其中使用 tabula 包读取 pdf 表,但是由于 tabula 依赖于 Java 8,并且由于某些内部工具,我们必须使用 java 6 及以下版本,我们如何读取表。
from tabula import read_pdf
df_list = tabula.read_pdf(current_file, pages="all", lattice = True)
最佳答案
如何将 pdf 文档转换为 Excel 电子表格:
选项 1,使用 pdf_tables API:
pip install git+https://github.com/pdftables/python-pdftables-api.git
import pdftables_api
c = pdftables_api.Client('my-api-key')
c.xlsx('input.pdf', 'output')
#replace c.xlsx with c.csv to convert to CSV
#replace c.xlsx with c.xml to convert to XML
#replace c.xlsx with c.html to convert to HTML
#This is documentation code for your information
不要忘记将 my-api-key 替换为您的 api key ,将 input.pdf 替换为您的 pdf 的路径,并将输出到您要将输出 excel 文档保存到的目录的路径。
pip install textract
安装textract pip install xlwt
安装 xlwt import textract
import xlwt
from xlwt import Workbook
wb = Workbook()
text = textract.process("path/to/file.extension") #You'll have to change this to your path to the file
我不知道您的 pdf 是如何组织的,但您必须弄清楚如何从那里写入 excel 文档。 (您可以使用
sheet1.write(1, 0, 'Data')
,其中 1 和 0 是您在电子表格上的坐标。
关于python - 我如何提取除 tabula 以外的 pdf 表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68714113/
我尝试使用 python 模块“tabula”,但显然我已经安装失败了。我只是使用了代码 import tabula 但是,我收到以下错误消息: ModuleNotFoundError: No mod
我正在尝试使用 Tabula-py 来阅读 pdf。我通过 pip install tabula-py 安装了 tabula-py 我还安装了所需的依赖项 requests pandas pytest
我已经在Azure运行了4个月的管道,昨天晚上突然坏了。我有以下代码:。我突然发现了这个错误:。任何帮助都将不胜感激。
我们可以选择通过指定坐标从 PDF 文档中提取表格。对于 Windows 用户,为了获取坐标,您必须将 PDF 文件上传到 Tabula 网页并导出包含坐标的脚本,然后将坐标输入到您的代码中。对于 M
我想要 PDF 中的表格数据,我正在使用以下命令获取表格数据 java -jar tabula-java.jar -a 301.95,14.85,841.0500000000001,695.25 -t
我正在使用 Python 3.5 和 Anaconda 发行版。 tabula-py 版本 1.1.1 已安装。当我运行以下简单程序时: import tabula df = tabula.read_
我安装了 python 模块 tabula-py,它显然是基于 Java 版本的 tabula。当我尝试运行它时,我收到一条错误消息,指出安装了错误版本的 Java,但当我在 MacOS 上检查系统首
我一直收到这个错误。我正在研究 - 苹果塞拉利昂 10.8 python 3.6.2 表格 1.0.5 Traceback (most recent call last): File "/User
PDF文件内容是中文(文字,不是图片等),所以可能会使用不同的字体。我的代码: >>> import tabula >>> df = tabula.read_pdf('/data/proj/smart
tabula.convert_into(filename_final, (filename_zero + '.csv'), output_format="csv
我有一个使用 tabula.read_pdf 的脚本。脚本工作正常,但是当我使用 PyInstaller (使用 --noconsole 选项)构建 exe 文件并运行我的脚本时 - 它会打开 jav
我正在尝试从 PDF 中抓取数据,以便可以重新格式化它,然后将其插入到 Oracle 中的表中。我正在尝试使用 Tabula 读取 PDF 并将其转换为表列表,但如果这些列仅包含空值,Tabula 似
我刚刚发现了 tabula-py(当然还有 tabula-java)从 pdf 中提取表格的乐趣。我现在正在为我的工作编写一个脚本,该脚本从 pdf 表中读取一些数据,对其进行一些清理,然后将其导出到
在 Python 3 中,我有一个包含 6,041 页的 PDF 文件“Ativos_Fevereiro_2018_servidores.pdf”。我在装有 Ubuntu 的机器上。文件在这里:htt
一个 .py程序可以运行,但完全相同的代码,当作为 API 公开时,不起作用。 该代码使用 Tabula 读取 pdf 并提供表格内容作为输出。 我试过了 : import tabula df = t
我尝试使用Python包tabula-py来读取table在pdf中,pdf表格单元格中的换行符似乎会将原始单元格中的内容分成多个单元格。 我尝试搜索各种python包来解决这个问题。看来 tabul
我在 python 中有这段代码,我用它打开子进程模块并继续从那里获取数据,但我不知道如何对来自不同目录的文件进行 OCR。我试过将完整的文件路径放到文件名应该在代码中的目录中,但它似乎没有用。如何在
这个问题在这里已经有了答案: How can I extract tables from PDF documents? (4 个答案) 关闭 8 天前。 尝试使用 Python 3.6 从 PDF
我正在尝试使用 tabula-py 从多页 PDF 中提取表格,虽然 PDF 的某些页面上的表格被完美提取,但一些页面被完全省略。 遗漏似乎是随机的,不遵循 PDF 上的任何可见视觉特征(因为每个页面
我想知道是否有熟悉 Python 的 tabula-py 模块的人可以帮助我解决这个问题。在任何 tabula-py 文档中都不清楚 tabula.read_pdf() 是否如果没有lattice 或
我是一名优秀的程序员,十分优秀!