Skip to main content

a Python library to interact with a collection of frictionless datapackages

Project description

Binder DOI

unitpackage

A Python library to create, interact with, and store collections of frictionless Data Packages whose tabular resources carry unit-aware field metadata. Each data package pairs a CSV file with a JSON descriptor containing schema information (column names, types, units) and arbitrary nested metadata.

Key features

  • Unit-aware fields — columns carry unit metadata (e.g. V, A / m2, s) and can be rescaled to compatible units.
  • Collections — load, filter, slice, and iterate over sets of data packages from local directories or remote sources.
  • Metadata access — nested metadata is accessible via attribute-style or dict-style access.
  • Plotting — built-in 2D plotting with plotly.
  • Domain extensions — subclass Collection and Entry for domain-specific features (e.g. electrochemistry via Echemdb).

Quick example

>>> from unitpackage.collection import Collection
>>> db = Collection.from_local('./doc/files')
>>> entry = db['demo_package_cv']
>>> entry.echemdb.description
'Sample data for the unitpackage module'

Access field units and rescale data:

>>> entry.field_unit('j')
'A / m2'
>>> entry.rescale({'E' : 'mV', 'j' : 'uA / m2'}).df
          t           E             j
0  0.000000 -196.961730  43008.842162
1  0.011368 -196.393321  51408.199892
...

Plot directly from an entry:

>>> entry.plot()

Rescale an entire collection at once:

>>> rescaled = db.rescale({'E': 'mV', 'j': 'uA / m2'})
>>> rescaled[0].field_unit('E')
'mV'

Detailed usage examples, including local collection creation and metadata handling, are provided in the documentation.

Installation

This package is available on PyPI and can be installed with pip:

pip install unitpackage

The package is also available on conda-forge and can be installed with conda

conda install -c conda-forge unitpackage

Please consult our documentation for more detailed installation instructions.

License

The contents of this repository are licensed under the GNU General Public License v3.0 or, at your option, any later version.

Project details


Download files

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

Source Distribution

unitpackage-0.13.0.tar.gz (61.7 kB view details)

Uploaded Source

Built Distribution

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

unitpackage-0.13.0-py3-none-any.whl (73.1 kB view details)

Uploaded Python 3

File details

Details for the file unitpackage-0.13.0.tar.gz.

File metadata

  • Download URL: unitpackage-0.13.0.tar.gz
  • Upload date:
  • Size: 61.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for unitpackage-0.13.0.tar.gz
Algorithm Hash digest
SHA256 9852c4b13142bef558abb6543e5c12a4862db8d3a17546efa79c9e694dc63fb5
MD5 5a3aa0a6aa063a99d926f1c56c376638
BLAKE2b-256 e01dce19ed26e260f464421b024615e0dd95a1971e86a9c9c081e660dfc96b1a

See more details on using hashes here.

File details

Details for the file unitpackage-0.13.0-py3-none-any.whl.

File metadata

  • Download URL: unitpackage-0.13.0-py3-none-any.whl
  • Upload date:
  • Size: 73.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for unitpackage-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b4e7bca50389ca7ac5e214b9d2dd9b0fd5daa564488ec94aa0a9a3ae688a58ea
MD5 bf7bd51552aa7a588b17965b4867e41d
BLAKE2b-256 db3aba3a197fcf1df9b391a2ebe7c701495f313e0d3f21cfb5e41c7a782475e3

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