Skip to main content

pytablereader is a python library to load structured table data from files/URL with various data format: CSV/HTML/JSON/Markdown/MediaWiki/MediaWiki/Excel.

Project description

pytablereader

https://badge.fury.io/py/pytablereader.svg https://img.shields.io/pypi/pyversions/pytablereader.svg Linux CI test status Windows CI test status https://coveralls.io/repos/github/thombashi/pytablereader/badge.svg?branch=master

Summary

pytablereader is a python library to load structured table data from files/URL with various data format: CSV/HTML/JSON/Markdown/MediaWiki/MediaWiki/Excel.

Feature

  • Extract structured table data from various data format:
    • CSV file/text

    • Microsoft Excel TM file

    • HTML file/text

    • JSON file/text

    • Markdown file/text

    • MediaWiki file/text

  • Supported data sources to read:
    • Files

    • URL

Examples

Load a CSV table

from __future__ import print_function
import pytablereader

# prepare data ---
file_path = "sample_data.csv"
csv_text = "\n".join([
    '"attr_a","attr_b","attr_c"',
    '1,4,"a"',
    '2,2.1,"bb"',
    '3,120.9,"ccc"',
])

with open(file_path, "w") as f:
    f.write(csv_text)

# load from a csv file ---
loader = pytablereader.CsvTableFileLoader(file_path)
for table_data in loader.load():
    print("\n".join([
        "load from file",
        "==============",
        "{:s}".format(table_data.dumps()),
    ]))

# load from a csv text ---
loader = pytablereader.CsvTableTextLoader(csv_text)
for table_data in loader.load():
    print("\n".join([
        "load from text",
        "==============",
        "{:s}".format(table_data.dumps()),
    ]))
load from file
==============
.. table:: sample_data

    ======  ======  ======
    attr_a  attr_b  attr_c
    ======  ======  ======
         1     4.0  a
         2     2.1  bb
         3   120.9  ccc
    ======  ======  ======

load from text
==============
.. table:: csv2

    ======  ======  ======
    attr_a  attr_b  attr_c
    ======  ======  ======
         1     4.0  a
         2     2.1  bb
         3   120.9  ccc
    ======  ======  ======

For more information

More examples are available at http://pytablereader.readthedocs.org/en/latest/pages/examples/index.html

Installation

pip install pytablereader

Dependencies

Python 2.7+ or 3.3+

Mandatory Python packages

Optional Python packages

  • pypandoc
    • required when loading MediaWiki file

  • pandas
    • required to get table data as a pandas data frame

Optional packages (other than Python packages)

  • lxml (faster HTML convert if installed)

  • pandoc (required when loading MediaWiki file)

Test dependencies

Documentation

http://pytablereader.readthedocs.org/en/latest/

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

pytablereader-0.6.8.tar.gz (58.7 kB view details)

Uploaded Source

Built Distribution

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

pytablereader-0.6.8-py2.py3-none-any.whl (43.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pytablereader-0.6.8.tar.gz.

File metadata

  • Download URL: pytablereader-0.6.8.tar.gz
  • Upload date:
  • Size: 58.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pytablereader-0.6.8.tar.gz
Algorithm Hash digest
SHA256 d7b04f0c7670a3121d4f4ff945d63855a49ef703817de9b2080b886c42bc9d1d
MD5 6ba4b90260e473af3020ce6cdd024869
BLAKE2b-256 3ad380240c4b56ec8b0bcccc7611603e7f45407db7f90afec5e44dca1938b0b1

See more details on using hashes here.

File details

Details for the file pytablereader-0.6.8-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pytablereader-0.6.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 63629302f7507b50fab5799b8ca862d92bb9caaf61e92481842487c7d9377ada
MD5 24aff8f3544165581b4dbd8b68270984
BLAKE2b-256 83f00fdfb96c9fed8ce4ed6e752dfb990a97d68fc808f4a0c0a65bfc3f62e2ee

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