我使用camelot进行表数据提取,但是标题没有被提取为PDF的一部分。
连接目标
下面的PDF链接和目标表格位于第3页和第4页,需要提取。
https://drive.google.com/file/d/1xniTIwpnNIdA_k4xvEARlVH97Lk-K2Yr/view?usp=sharing https://drive.google.com/file/d/1xniTIwpnNIdA_k4xvEARlVH97Lk-K2Yr/view?usp=sharing
One of the tables looks like below
我看过camelot文档,我认为问题与“检测短线”
https://camelot-py.readthedocs.io/en/master/user/advanced.html#detect-short-lines https://camelot-py.readthedocs.io/en/master/user/advanced.html#detect-short-lines
但无法通过调整来解决问题线尺寸缩放范围。
请协助。
我使用以下方法在第 3 页上绘制了检测到的表格边界$ camelot -p 3 lattice -plot contour 007.pdf
。看起来 Camelot 未在检测到的表格边界中包含标题行 [bug 1](见下图)。然后我尝试使用table_areas
关键字参数与flavor='lattice'
但随后它不包含指定表边界中的行[bug 2]。我已将这些添加到问题跟踪器中#200 https://github.com/socialcopsdev/camelot/issues/200 and #201 https://github.com/socialcopsdev/camelot/issues/201.
您仍然可以使用table_areas
关键字参数与flavor='stream'
把桌子拿出来。
使用 CLI:$ camelot -p 3 --output 007.csv --format csv stream -T 60,770,520,400 007.pdf
使用API:tables = camelot.read_pdf('007.pdf', pages='3', flavor='stream', table_areas=['60,770,520,400'])
您可以使用此处描述的步骤找到表格边界坐标:https://camelot-py.readthedocs.io/en/master/user/advanced.html#visual-debugging https://camelot-py.readthedocs.io/en/master/user/advanced.html#visual-debugging
希望有帮助!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)