Tabula-py returns '...' 在 df 中的一个特定列上。其他一切似乎都有效,

Tabula-py returns '...' on one specific column in df. everything else seems to work,

预期行为:

读取PDF,提取所有table数据到pandasdf.

实际行为:

可以很好地读取 PDF,提取大部分 table 数据并将其保存到 debugging.txt 和 fp.write(df)。当我查看 debugging.txt 或观看终端打印时,一列(名称)通常只有 returns '...'。

大约有 9/10 次返回...- 有时只是第一页,但其余的都很好。有的时候还好。。。好像很奇怪。

(我可能是个白痴,它可能会缩短它,因为它是迄今为止最长的字符串,缩短了 2-3 倍。但是我的 Google Fu 让我失望了)

示例输入(保护隐私的名称):

示例输出:

21        121         87    59 2003  ...         NaN        NaN         NaN
22        122         86    59 2026  ...         NaN        NaN         NaN
23        123         85    60 2038  ...         NaN        NaN         NaN
24        124         84    60 2050  ...         NaN        NaN         NaN
25        125         83    61 2056  ...         NaN        NaN         NaN
26        126         82    61 2095  ...         NaN        NaN         NaN

代码:

pagecount = 0
for filename in os.listdir(SPLITDIR):

    print("Working on: {}".format(filename))

    if not filename.endswith(".pdf"):
        print("I dont think {} is a PDF".format(filename))
        continue

    pagedf = read_pdf(SPLITPATH.format(pagecount) pages='all')
    #print(pagedf)
    debugextract.write(str(pagedf))

    pagedf = pd.DataFrame(pagedf)
    print(pagedf)

    pagecount += 1

这不是来自 tabula,而是 ipython 或 Jupyter 的显示设置。

另见 https://github.com/chezou/tabula-py/issues/216#issuecomment-581837621