【问题标题】:What is causing AttributeError: 'list' object has no attribute 'read' when tying to read in a pdf with Tabula?是什么导致 AttributeError: 'list' object has no attribute 'read' when tying to read in a pdf with Tabula?
【发布时间】:2019-09-02 22:45:26
【问题描述】:

我正在尝试使用 Tabula 从 pdf 中提取表格信息并将其转换为 pandas 数据框。我一直按照本教程中的步骤进行操作:

https://aegis4048.github.io/parse-pdf-files-while-retaining-structure-with-tabula-py

当我尝试使用以下代码(直接取自教程)将远程 PDF 加载到我的 jupyter 笔记本中时:

import tabula
df2 = tabula.read_pdf("https://github.com/tabulapdf/tabula-java/raw/master/src/test/resources/technology/tabula/arabic.pdf")

我得到错误:

AttributeError: 'list' 对象没有属性 'read'

我尝试读取本地保存到我的机器的 pdf,但我得到了同样的错误。我相信我已经成功安装了 Java 并正确配置了环境变量,并且我拥有最新版本的 Tabula。

链接到我的 jupyter 笔记本的屏幕截图:

https://www.dropbox.com/s/y44mfzuclihfdau/S_O_Capture_1.PNG?dl=0

谢谢。

【问题讨论】:

  • 你是否使用pip3 install tabula安装了这个包?

标签: python-3.x tabula


【解决方案1】:

确保您安装了正确的tabula 包!

如果你运行pip3 install tabula,那么你安装了一个冒名顶替者!

运行pip3 uninstall tabula 将其删除,然后运行:

pip3 install tabula-py

安装正确的包。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-01-10
    • 2020-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-31
    • 2021-05-24
    相关资源
    最近更新 更多