【发布时间】:2021-09-30 14:13:35
【问题描述】:
我的代码是这样的:
df = tabula.read_pdf('test.pdf', pages = ['all'])[0]
df.head()
df.to_excel('test.xlsx')`
当我运行它时,我的 Excel 中只有第一页...
【问题讨论】:
标签: python excel pdf spyder screen-scraping
我的代码是这样的:
df = tabula.read_pdf('test.pdf', pages = ['all'])[0]
df.head()
df.to_excel('test.xlsx')`
当我运行它时,我的 Excel 中只有第一页...
【问题讨论】:
标签: python excel pdf spyder screen-scraping
您阅读了包含所有页面的整个 pdf,但您获取了第一个元素。
df = tabula.read_pdf('test.pdf', pages = ['all'])[0]
^^^
我认为您必须将其删除并连接它才能使所有页面都表现出色。类似的东西:
dfs = tabula.read_pdf(self.file, pages='all')
df = pd.concat(dfs)
df.to_excel("filename.xlsx")
Here 是一篇如何处理 pdf 的好文章
【讨论】: