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
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
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.6.6.tar.gz
(58.4 kB
view hashes)
Built Distribution
Close
Hashes for pytablereader-0.6.6-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 970d5438143ea660de3c70d048d8ec837a6634a976d048bfa3c5d5dbd837f2af |
|
MD5 | 72aca8280bcbb9b8e4f015e469131433 |
|
BLAKE2b-256 | 1d80b9ee3ae7bb709b95894b5b229a563c14e2a0ad0e1909d13cdce7c26df617 |