pytablereader is a python library to load structured table data from files/URL with various data format: CSV/Excel/HTML/JSON/LTSV/Markdown/MediaWiki/MediaWiki/TSV.
Project description
pytablereader
Summary
pytablereader is a python library to load structured table data from files/URL with various data format: CSV/Excel/HTML/JSON/LTSV/Markdown/MediaWiki/MediaWiki/TSV.
Features
- Extract structured tabular data from various data format:
CSV
Microsoft Excel TM
HTML
JSON
Markdown
MediaWiki
Tab separated values (TSV)
- Supported data sources to read:
Files on a local file system
Accessible URL
str instance
Examples
Load a CSV table
import pytablereader as ptr
import pytablewriter as ptw
# 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 = ptr.CsvTableFileLoader(file_path)
for table_data in loader.load():
print("\n".join([
"load from file",
"==============",
"{:s}".format(ptw.dump_tabledata(table_data)),
]))
# load from a csv text ---
loader = ptr.CsvTableTextLoader(csv_text)
for table_data in loader.load():
print("\n".join([
"load from text",
"==============",
"{:s}".format(ptw.dump_tabledata(table_data)),
]))
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.8.1.tar.gz
(59.0 kB
view hashes)
Built Distribution
Close
Hashes for pytablereader-0.8.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7387b52d0b53c6292e741aa7b01d253599a85031dbc6270b7f41691fe23bbf7 |
|
MD5 | 5d1e41c9714ddb6647a117568f21746c |
|
BLAKE2b-256 | 63fc56324a33690066f461eb6b282da2aa98c17112f80ceeb7cbd93ee9673b82 |