Created
May 16, 2019 02:16
-
-
Save gilsondev/f38d3f021d900841427d9e6d8cbaf218 to your computer and use it in GitHub Desktop.
Example to use camelot-py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Camelot: PDF Table Extraction for Humans | |
# Documentation: https://camelot-py.readthedocs.io/en/master/ | |
import camelot | |
# Read the PDF and specify the pages | |
tables = camelot.read_pdf("manual.pdf", pages='27') | |
# Visualize with pandas | |
tables[0].df | |
# Save the table to CSV | |
# Compress to zip, and have two files: | |
# - result_zip-page-27-table-0.csv | |
# - result_zip-page-27-table-1.csv | |
tables.export('result_zip.csv', f='csv', compress=True) # json, excel, html | |
# Other option | |
tables[0].to_csv('result_file.csv') # to_json, to_excel, to_html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment