Skip to main content

kw

Utils to work with storage

To install: pip install kw

Overview

The kw package provides a comprehensive set of utilities designed to facilitate the manipulation, storage, and retrieval of data, particularly using HDF5 storage format with Pandas. It includes functionality for serializing and deserializing objects, handling large datasets efficiently, and performing complex data operations within stores. The package is particularly useful for scenarios involving large-scale data analysis and storage optimization in Python.

Features

  • Serialization and Compression: Functions for serializing objects with optional compression using gzip, allowing efficient storage of large Python objects.
  • Data Store Manipulation: Extensive support for manipulating HDF5 stores, including querying, appending, replacing, and managing data in a structured format.
  • Data Retrieval and Transformation: Utilities to fetch and transform data based on specific conditions and criteria.
  • Store Information Retrieval: Functions to extract detailed metadata and structure information from data stores.

Installation

To install the package, run the following command:

pip install kw

Usage Examples

Serializing Objects

Saving an Object with Compression

from kw import gz_pickle_dump

my_object = {'key': 'value'}
filename = 'data.pkl.gz'
gz_pickle_dump(my_object, filename)

Loading a Compressed Object

from kw import gz_pickle_load

loaded_object = gz_pickle_load('data.pkl.gz')

Working with HDFStores

Creating a Custom Store Class

from kw import MyStore

store = MyStore('my_data.h5')

Adding Data to the Store

import pandas as pd

df = pd.DataFrame({'A': [1, 2, 3]})
store.put('my_key', df)

Retrieving Data from the Store

retrieved_data = store.select('my_key')

Advanced Data Manipulation

Copying Data Between Stores

from kw import copy_data

copy_data('source_store.h5', 'target_store.h5', ['dataset1', 'dataset2'], overwrite=True)

Filtering and Selecting Data

from kw import StoreSelector

selector = StoreSelector('my_store.h5', 'my_key', 'A')
selected_data = selector.get_table(selection='value1')

Documentation

Each function and class in the kw package is documented with docstrings, providing a detailed description of its purpose, parameters, and usage examples. This documentation can be accessed through standard Python help functions, such as help() or by reading the source code directly.

Contributing

Contributions to the package are welcome. Please ensure that any pull requests or issues are submitted through the package's GitHub repository.

License

The kw package is open-sourced under the MIT license, which allows for liberal reuse and modification.

Metadata

Release files for kw 0.0.6

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

Source distribution (sdist)

Source distribution for kw 0.0.6
File Size Uploaded
kw-0.0.6.tar.gz 12.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kw 0.0.6
File Interpreter ABI Platform
kw-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 25.3 kB

Release files / kw-0.0.6.tar.gz

Download URL kw-0.0.6.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
06723c3651b60429344ebee4fafa8c896f63152a40a40adf7cc1de15877fb007
BLAKE2b-256 checksum
How to use checksums
ef0463dfaab537c148c7aa4d60963a107ecf5fe7a7da9fe4670e4bae26ca71b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / kw-0.0.6-py3-none-any.whl

Download URL kw-0.0.6-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8309ba17c6b5ccf6ab5ef967a1d752e0997876e993edfe33683e5a8f77330a99
BLAKE2b-256 checksum
How to use checksums
5d1093b9a402b839e5abeb8a8e76d7584192407667cf909865ea182fca0f2ba5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

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