【问题标题】:tabula error 'list' object has no attribute 'to_excel'表格错误 \'list\' 对象没有属性 \'to_excel\'
【发布时间】:2022-11-25 19:39:34
【问题描述】:

我试图将包含数据表的 PDF 文件转换为 excel 文件。 这是我的绳索。

import tabula
  
# Read PDF File
df = tabula.read_pdf("files/Seniority List 2018 19.pdf", pages = 1)
  
# Convert into Excel File
df.to_excel('files/excel.xlsx')

但发生错误。

AttributeError                            Traceback (most recent call last)
Input In [5], in <cell line: 9>()
      6 df = tabula.read_pdf("files/Seniority List 2018 19.pdf", pages = 1)
      8 # # Convert into Excel File
----> 9 df.to_excel('files/excel.xlsx')

AttributeError: 'list' object has no attribute 'to_excel'

PDF来自这里 https://www.docdroid.net/jTWmB15/seniority-list-2018-19-pdf

我如何使用“to_excel”?

我刚刚在这个问题中提到了上述设置,但如果需要更多代码,请告诉我我会用这些信息更新我的问题。谢谢

【问题讨论】:

    标签: python tabula


    【解决方案1】:
    df[0].to_excel('files/excel.xlsx')
    

    tabula 返回可能表的列表

    【讨论】:

      猜你喜欢
      • 2021-05-21
      • 1970-01-01
      • 1970-01-01
      • 2019-08-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-06
      • 1970-01-01
      相关资源
      最近更新 更多