Camelot is a Python library for extracting tabular data from PDFs.
The library addresses the challenge of recovering structured table data from unstructured PDF documents. It provides five distinct parsing strategies: lattice for ruled tables, stream for whitespace-based detection, network and hybrid modes using text alignment, and an optional machine learning backend using Table Transformer for borderless tables. Users can also enable optical character recognition to handle scanned or image-only PDFs. The tool combines vector line detection from the PDF itself with raster-based OpenCV detection to identify faintly-ruled tables that single approaches might miss.
Camelot suits projects requiring reliable table extraction without heavy dependencies. The default installation uses a bundled pdfium backend with no system requirements, while optional extras add neural network and OCR capabilities. Every extracted table becomes a pandas DataFrame, and the library supports export to CSV, JSON, Excel, HTML, Markdown, and SQLite. A command-line interface is included for quick extraction tasks. The tool handles multi-page tables through a stacking function and offers quality metrics per table—accuracy, whitespace ratio, and confidence scores—allowing users to filter out low-quality extractions. Configuration options cover table regions, column separators, and text processing.
The project maintains active engagement with its codebase, regularly addressing issues and incorporating user feedback. Development shows consistent attention to both core functionality and edge cases, with particular focus on improving parser robustness across different PDF types. The maintainers prioritize backward compatibility while expanding capabilities through optional dependencies rather than bloating the base installation.