Skip to main content

A package for extracting tables from images and PDFs

Project description

Table Info Extractor

Table Info Extractor is a Python package designed for extracting tables from images and PDFs using OCR (Optical Character Recognition). It supports automatic rotation detection, image preprocessing, and conversion of extracted tables into pandas DataFrames.

Features

  • Extract tables from images and PDFs.
  • Automatically detect and correct image orientation.
  • Enhance OCR results with preprocessing techniques (grayscale conversion, contrast enhancement, thresholding).
  • Convert extracted tables into pandas DataFrames for easy data manipulation and analysis.

Installation

You can install Table Info Extractor via pip:

pip install table_info_extractor

Usage

Image To Table Extraction

from table_info_extractor import image_to_table_extract

# Example: Extract tables from an image
extracted_tables_from_image = image_to_table_extract("path_to_your_image.jpg", auto_rotation=True)
print(extracted_tables_from_image)

PDF To Table Extraction

from table_info_extractor import pdf_to_table_extract

# Example: Extract tables from a PDF
extracted_tables_from_pdf = pdf_to_table_extract("path_to_your_pdf.pdf", page_number=1, auto_rotation=True)
print(extracted_tables_from_pdf)

Function Documentation

image_to_table_extract(image_path, auto_rotation=False)

Extracts tables from an image file.

  • image_path (str): Path to the input image file.
  • auto_rotation (bool): Whether to automatically correct image rotation.

Returns:

  • List of pandas DataFrames, each representing a table extracted from the image.

pdf_to_table_extract(pdf_path, page_number, auto_rotation=False)

Extracts tables from a specific page of a PDF file.

  • pdf_path (str): Path to the input PDF file.
  • page_number (int): Page number from which to extract tables (1-based index).
  • auto_rotation (bool): Whether to automatically correct image rotation.

Returns:

  • List of pandas DataFrames, each representing a table extracted from the PDF page.

Contribution

Contributions are welcome! To contribute to Table Info Extractor, please follow these steps:

  1. Fork the repository and clone it to your local machine.
  2. Create a new branch for your feature or bug fix: git checkout -b feature/my-feature.
  3. Make your changes and commit them with a descriptive message.
  4. Push your changes to the branch: git push origin feature/my-feature.
  5. Submit a pull request detailing your changes and why they should be included.

GitHub Repository

Table Data Extractor on GitHub

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

table_info_extractor-0.1.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

table_info_extractor-0.1.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file table_info_extractor-0.1.2.tar.gz.

File metadata

  • Download URL: table_info_extractor-0.1.2.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.7

File hashes

Hashes for table_info_extractor-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2176266a078d4ce95c0ee767155f181561ada10b231532efb0810238c564dd9c
MD5 f6850d107b91c25924ecb89e4f3fa64b
BLAKE2b-256 9bff1b03ecb2fb9d6435338eb8c86385d38b0e386a860f24f62bbdcd739ae23c

See more details on using hashes here.

File details

Details for the file table_info_extractor-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for table_info_extractor-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6702832df034b9a8bd3da1f1c6cf2ab68bd3f9399c9dd96558baa3265cce7b4c
MD5 dae8cc57569ac9aa6d59e527a5655f11
BLAKE2b-256 00270bc57129773aa0a0db731d7ece05674394309e89fe9c3c75bd4d1e210d0e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page