Ric*_*hie 8 python-3.x python-camelot
我正在努力提取一些无边框表格,如下图所示,它们来自 pdf 文件。我已经安装了 python-camelot,如图所示,并且仅适用于带边框的表。请查看以下详细信息:
平台 - Linux-4.5.5-300.fc24.x86_64-x86_64-with-fedora-24-Twenty_Four
sys - Python 3.6.1(默认,2017 年 5 月 15 日,11:42:04)[GCC 6.3.1 20161221 (Red Hat 6.3.1-1)]
numpy - NumPy 1.15.4
cv2 - OpenCV 3.4.3
卡米洛特 - 卡米洛特 0.3.2
小智 11
为了改善检测区域,您可以增加 edge_tol(默认值:50)值以抵消文本垂直放置相对较远的影响。较大的 edge_tol 将导致检测到更长的文本边缘,从而改进对表格区域的猜测。让我们使用 500 的值。
>>> tables = camelot.read_pdf('edge_tol.pdf', flavor='stream', edge_tol=500)
>>> camelot.plot(tables[0], kind='contour')
>>> plt.show()
>>> tables[0].df
Run Code Online (Sandbox Code Playgroud)
小智 5
Camelot 默认使用点阵,它依赖于划分单元格的清晰线条。
对于没有要使用流的行的表:
tables = camelot.read_pdf('your_file_name.pdf', flavor = 'stream')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5539 次 |
| 最近记录: |