Reads and writes data stored in StarTable format; and stores table data inmemory as a Pandas data frame for easy manipulation.
Project description
pdtable
The pdtable
Python package offers interfaces to read, write, and manipulate StarTable data.
For a full demo, see the pdtable_demo notebook or, if you a Jupyter notebook doesn't do it for you, the notebook's paired script.
Data and metadata: storage and access
Table blocks are stored as TableDataFrame
objects, which inherit from pandas.DataFrame
but include additional, hidden metadata. This hidden metadata contains all the information from Table blocks that does not fit in a classic Pandas dataframe object: table destinations, column units, table origin, etc.
Data in TableDataFrame
objects can be accessed and manipulated using the Pandas API as it the object were a vanilla Pandas dataframe, with all the convenience that this entails.
The StarTable-specific metadata hidden in a TableDataFrame
's metadata can in principle be accessed directly; however a much more ergonomic interface is offered via a Table
facade object, which is a thin wrapper around TableDataFrame
. Table
also supports some limited data manipulation, though with the advantage of more easily supporting StarTable-specific metadata; for example, easily specifying column units when adding new columns.
I/O
Readers and writers are available for CSV files, CSV text streams, and Excel workbooks. Parsing is efficient and, by default, lenient, though this is readily customized.
Reading can also be filtered early, such that only certain block types or tables with certain names get fully parsed. This can reduce reading time substantially when reading e.g. only a few tables from an otherwise large file or stream.
Directive blocks are parsed by the readers, and presented to the client code for application-specific interpretation.
Import from and export to JSON is also supported.
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
File details
Details for the file pdtable-0.0.2.tar.gz
.
File metadata
- Download URL: pdtable-0.0.2.tar.gz
- Upload date:
- Size: 54.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 019b1b7abd245fa02ef33b83ed8865ca89f15e59c8098e104e91a1804488542b |
|
MD5 | 0ede6b93afa1d59f92fcf99cd4f14a48 |
|
BLAKE2b-256 | 5e1cd8cc2310c971d48a7eff56a58a33ef47ce83bb2e1d208d19946fb0af2412 |