Skip to main content

Utils to work with storage

Project description

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.

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

kw-0.0.5.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

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

kw-0.0.5-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file kw-0.0.5.tar.gz.

File metadata

  • Download URL: kw-0.0.5.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for kw-0.0.5.tar.gz
Algorithm Hash digest
SHA256 e461dc0d536bcd5618573e7f9db8bef68c0f66d3eafdb54a5b4b4c02876e1f7b
MD5 0011626954a11235b65948e9d27f32c0
BLAKE2b-256 fcad31348d80a6b3f930df0ced3440db5baa107685e57157e728bb9921315516

See more details on using hashes here.

File details

Details for the file kw-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: kw-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for kw-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 99077564272d6c07edc4b8cbf42322623ada04e4ab50cf588a701629148f92bf
MD5 58ec4d604e9d6b1a8599b9c1657cbfee
BLAKE2b-256 5f0a845a034fe6131c3264143473e9ee29e32f73ee77950c773a870f8b509f5f

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