0

I want to put all tables of a PDF into a single DataFrame and the tables to have the same columns.

ka1 = camelot.read_pdf(r"example.pdf",'all')

for i,table in enumerate(ka1):
 v = table.df
 w = pd.concat(v)

print(w)
Gino Mempin
  • 25,369
  • 29
  • 96
  • 135

1 Answers1

2

pandas.concat() expects a list of DataFrames. You could add all the DataFrames to a list in the for loop and concat them afterwards. For example:

ka1 = camelot.read_pdf(r"example.pdf",'all')

v = []
for i,table in enumerate(ka1):
    v.append(table.df)
w = pd.concat(v)

print(w)
Sam
  • 171
  • 1
  • 4