Camelot is a Python library
that allows for the easy extraction of data tables from
Camelot has multiple settings that can be tweaked for better extraction of data in tables. This offers more control over the extraction process than other available libraries.
The following command installs Camelot:
pip install "camelot-py[cv]"
Below is a basic code that reads a table in a PDF and converts it to a CSV and Dataframe:
import camelot
table = camelot.read_pdf('sample.pdf')
print(table) // Displays the number of tables read from the pdf
table.export('sample_table.csv', f='csv', compress=True) // saves the table to a csv file.
table[0] // displays the table shape
tables[0].df // converts the table to a dataframe.