Skip to main content

Simple wrapper for tabula-java, read tables from PDF into DataFrame

Project description

tabula-py

Build Status PyPI version Documentation Status PyPI - Downloads

tabula-py is a simple Python wrapper of tabula-java, which can read tables in a PDF. You can read tables from a PDF and convert them into a pandas DataFrame. tabula-py also enables you to convert a PDF file into a CSV, a TSV or a JSON file.

You can see the example notebook and try it on Google Colab, or we highly recommend reading our documentation, especially the FAQ section.

tabula-py example

Requirements

  • Java 8+
  • Python 3.8+

OS

I confirmed working on macOS and Ubuntu. But some people confirm it works on Windows 10. See also the documentation for the detailed installation for Windows 10.

Usage

Install

Ensure you have a Java runtime and set the PATH for it.

pip install tabula-py

If you want to leverage faster execution with jpype, install with jpype extra.

pip install tabula-py[jpype]

Example

tabula-py enables you to extract tables from a PDF into a DataFrame, or a JSON. It can also extract tables from a PDF and save the file as a CSV, a TSV, or a JSON.  

import tabula

# Read pdf into list of DataFrame
dfs = tabula.read_pdf("test.pdf", pages='all')

# Read remote pdf into list of DataFrame
dfs2 = tabula.read_pdf("https://github.com/tabulapdf/tabula-java/raw/master/src/test/resources/technology/tabula/arabic.pdf")

# convert PDF into CSV file
tabula.convert_into("test.pdf", "output.csv", output_format="csv", pages='all')

# convert all PDFs in a directory
tabula.convert_into_by_batch("input_directory", output_format='csv', pages='all')

See an example notebook for more details. I also recommend reading the tutorial article written by @aegis4048, and another tutorial written by @tdpetrou.

Contributing

Interested in helping out? I'd love to have your help!

You can help by:

  • Reporting a bug.
  • Adding or editing documentation.
  • Contributing code via a Pull Request. See also for the contribution
  • Write a blog post or spread the word about tabula-py to people who might be able to benefit from using it.

Contributors

Another support

You can also support our continued work on tabula-py with a donation on GitHub Sponsors or Patreon.

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

tabula_py-2.10.0rc1.tar.gz (12.5 MB view details)

Uploaded Source

Built Distribution

tabula_py-2.10.0rc1-py3-none-any.whl (12.0 MB view details)

Uploaded Python 3

File details

Details for the file tabula_py-2.10.0rc1.tar.gz.

File metadata

  • Download URL: tabula_py-2.10.0rc1.tar.gz
  • Upload date:
  • Size: 12.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for tabula_py-2.10.0rc1.tar.gz
Algorithm Hash digest
SHA256 100010973bd4d29a887268c7c77ceba06d37c973a9e225f7dbc270338701949a
MD5 2c72aa10632bfdd6525c10c42fc0b75d
BLAKE2b-256 9bd465055da5c561dcef22a8a80fab6ecce631f61b0d7e46cba5e8b02dcade88

See more details on using hashes here.

File details

Details for the file tabula_py-2.10.0rc1-py3-none-any.whl.

File metadata

File hashes

Hashes for tabula_py-2.10.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 6fa047cec208a8686d46bc9188114cde4be48f474b7aace2fef5d5255849f486
MD5 72c0432c9b7f1e2e51e2c1a9484dc2ad
BLAKE2b-256 fb68f83d57dea3a5e4caa7a3ab9587088ed8bbfc85249f4fd15d4dcf62545cae

See more details on using hashes here.

Supported by

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