Skip to main content

End-to-End table structure detector

Project description

Tabledetector

PyPI

Tabledetector is a Python package that takes PDFs or Images as input, checks the alignment, re-aligns if required, detects the table structure, extracts data, return as pandas dataframe for further use. The current implementation focuses on bordered, semibordered and unbordered table structures.

Features

  • PDF Input: Accepts PDF/Image files as input for table detection.
  • Alignment Check: Verifies and adjusts alignment of input.
  • Table Detection: Identifies bordered, semibordered and unbordered tables in the PDF/Image File.
  • Table Extraction: Extract the tabular data in the form of dataframe.

Libraries Used

  • Python 3.x
  • OpenCV
  • NumPy
  • pdf2image
  • Pillow
  • scipy
  • jinja2
  • easyocr
  • pandas

Create and Activate Environment

conda create -n <env_name> python=3.7
conda activate <env_name>

Installation of package using pip

pip install tabledetector

Clone the repository for latest development release

git clone https://github.com/rajban94/TableDetector.git

Dependency

To utilize this library on Windows, ensure that Poppler is installed and its path is added to the environment variables.

Usage

Detection

For bordered table detection and if rotation not required:

import tabledetector as td
result = td.detect(pdf_path="pdf_path", type="bordered", rotation=False, method='detect')

For semibordered table detection and if rotation not required:

import tabledetector as td
result = td.detect(pdf_path="pdf_path", method="semibordered", rotation=False, method='detect')

For unbordered table detection and if rotation not required:

import tabledetector as td
result = td.detect(pdf_path="pdf_path", method="unbordered", rotation=False, method='detect')

Extraction

For bordered table detection and extraction and if rotation not required:

import tabledetector as td
result = td.detect(pdf_path="pdf_path", type="bordered", rotation=False, method='extract')

For semibordered table detection and extraction and if rotation not required:

import tabledetector as td
result = td.detect(pdf_path="pdf_path", method="semibordered", rotation=False, method='extract')

For unbordered table detection and extraction and if rotation not required:

import tabledetector as td
result = td.detect(pdf_path="pdf_path", method="unbordered", rotation=False, method='extract')

If no method is mentioned in that case it will check for all the methods and will provide the result accordingly. Also if rotation required make the rotation = True.

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

tabledetector-1.0.2.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

tabledetector-1.0.2-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file tabledetector-1.0.2.tar.gz.

File metadata

  • Download URL: tabledetector-1.0.2.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.16

File hashes

Hashes for tabledetector-1.0.2.tar.gz
Algorithm Hash digest
SHA256 d4d9b400a0c1e86668c57b4d262189b83f705124349abe47505f775534a0e102
MD5 ffc292d4349722d6fcceebb6683f80c1
BLAKE2b-256 736436e34094bf2f5b2dba3dcaa1f5eb8076079842583ee210563a05f2ea329a

See more details on using hashes here.

File details

Details for the file tabledetector-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: tabledetector-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.16

File hashes

Hashes for tabledetector-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3da9f2cdbeab563de740d9ee17ad2a98e26fc01cfe195bd376f1dd9b66728b9a
MD5 4b75ed5daa502d951202b6924d2ebf63
BLAKE2b-256 7761975ab43474d7218ce021c3d25dabc67233dbd5526cc08b0cbc3fbbb51cb8

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