Skip to main content

ratschlab-common

Small library of common code used in various projects in the ratschlab.

Features

  • Writing parquet and HDF5 files with sensible defaults ratschlab_common.io.dataframe_formats.
  • Support for working with 'chunkfiles', i.e. splitting up a large dataset in smaller chunks which can be processed independently (see example notebook):
    • Repartition records (i.e. increase or decrease number of chunkfiles) while keeping data belonging together in the same file (e.g. data with the same patient id associated)
    • simple indexing for looking up in which chunk to find data belonging e.g. to a patient
  • bigmatrix: support for creating and reading large matrices stored in HDF5 having additional metadata on the axes in form of data frames (see example notebook.)
  • small wrappers for spark and dask (spark example.)
  • saving sparse pandas dataframes to hdf5, see example notebook

Tools

ratschlab-common also comes with some command line tools:

  • pq-tool: inspect parquet files on the command line
    • pq-tool head: first records
    • pq-tool tail: last records
    • pq-tool cat: all records
    • pq-tool schema: schema of a parquet file
  • export-db-to-files: Tool to dump (postgres) database tables into parquet files. Large tables can be partitioned on a key and dumped into separate file chunks. This allows for further processing to be easily done in parallel.
  • bigmatrix-repack: rechunking/packing bigmatrix hdf5 files

Installation and Requirements

The library along with all the required dependencies can be installed with:

pip install ratschlab-common[complete]

Depending on whether you plan to use spark or dask or none of them you could install ratschlab-common through either of the commands

pip install ratschlab-common
pip install ratschlab-common[spark]
pip install ratschlab-common[dask]

Note, that if you plan on using spark make sure, you have Java 8 and either python 3.6 or 3.7 installed (python 3.8 is currently not supported by pyspark).

Metadata

Release files for ratschlab-common 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ratschlab-common 0.3.0
File Size Uploaded
ratschlab_common-0.3.0.tar.gz 36.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ratschlab-common 0.3.0
File Interpreter ABI Platform
ratschlab_common-0.3.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 73.4 kB

Release files / ratschlab_common-0.3.0.tar.gz

Download URL ratschlab_common-0.3.0.tar.gz
Size 36.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b26fd856b15f0e1229a2cd715925d68a71f47af5d48f1e16687b96eed57650af
BLAKE2b-256 checksum
How to use checksums
5f280a3cdc84dafafdc3c26ecb64b025c1c0c717bdc201f58e0b2ee29e493aed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200604 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.0

Release files / ratschlab_common-0.3.0-py2.py3-none-any.whl

Download URL ratschlab_common-0.3.0-py2.py3-none-any.whl
Size 36.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c69f2010da947d4942f659df26cdf91ac684e3f3b70382a99585670a89203a8f
BLAKE2b-256 checksum
How to use checksums
85378b5668279be38226c6887cc7d3de0d817c236e6363ab4ef5fba94eb3e244
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200604 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.0

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page