pytablereader is a python library to load structured table data from various data format: CSV/Excel/HTML/JSON/Markdown/MediaWiki/MediaWiki.
Project description
pytablereader
Summary
pytablereader is a python library to load structured table data from various data format: CSV/Excel/HTML/JSON/Markdown/MediaWiki/MediaWiki.
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
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("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("load from text: {:s}".format(table_data.dumps()))
load from file: TableData:
table_name: sample_data
header_list: attr_a, attr_b, attr_c
record_list:
['1', '4', u'a']
['2', '2.1', u'bb']
['3', '120.9', u'ccc']
load from text: TableData:
table_name: csv2
header_list: attr_a, attr_b, attr_c
record_list:
['1', '4', u'a']
['2', '2.1', u'bb']
['3', '120.9', u'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
DataPropery (Used to extract data types)
Optional Python packages
Optional packages (other than Python packages)
Test dependencies
Documentation
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.2.1.tar.gz
(22.9 kB
view hashes)
Built Distribution
Close
Hashes for pytablereader-0.2.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcadb55b2228f9effeec4625e09a0e00575722b11a065b75cab9b6a2523b514c |
|
MD5 | 3f4c7b96354915915d8bdde2c5215076 |
|
BLAKE2b-256 | 29117284199198919fec18a7b28b69c1a56853f31ad2ec11e39fb37d5dd038f6 |