Skip to main content

A blazingly fast datadict library

Project description

Teapy

Build PyPI codecov

Blazingly fast datadict library in Python

Teapy is a high-performance data dictionary library implemented in Rust, designed for blazingly fast operations. It offers the following features:

  • Lazy evaluation
  • Handling of NaN values
  • Multi-threaded processing
  • Support for any dimensionality

Setup

Install the latest teapy version with: pip install teapy

Basic Usage

Creating Expressions

# Expressions can be created in various ways
import numpy as np
import pandas as pd
import polars as pl
import teapy as tp

e1 = tp.Expr([1, 2, 3])  # Create from a list
e2 = tp.Expr((1, 2, 3))  # Create from a tuple
e3 = tp.Expr(np.array([1, 2, 3]), 'e3')  # Create from a numpy.ndarray, name is e3
e4 = tp.Expr(pd.Series([1, 2, 3]))  # Create from a pandas.Series
e5 = tp.Expr(pl.Series([1, 2, 3]))  # Create from a polars.Series

Creating DataDicts

# DataDicts can be created in different ways
dd1 = tp.DataDict({'a': [1, 2], 'b': [2, 3]}, c=[3, 4])  # Create from a dictionary
dd2 = tp.DataDict([tp.Expr([1, 2], 'a'), tp.Expr([2, 3], 'b')])  # Create from a list of expressions
dd3 = tp.DataDict(a=[1, 2], b=[2, 3], c=np.array([3, 6, 2]))  # Create by specifying key-value pairs

Evaluating Expressions and DataDicts

# Evaluating Expressions
e = tp.Expr([1, 2, 3]).mean()
e.eval()  # Execute the expression
e.view  # View the memory of the array
e.eview()  # Execute the expression and view the memory of the array
e.value()  # Execute the expression and copy the memory of the array to a new numpy.ndarray

# Evaluating DataDicts
dd = tp.DataDict({'a': [1, 2]*10, 'b': [2, 3]*10}, c=[3, 4])
dd = dd.select([
    dd['a'].ts_mean(3).alias('d'), 
    dd['b'].ts_std(4).alias('e')
])
dd.eval(['d', 'e'])  # Evaluate specific keys in parallel
dd.eval()  # Or evaluate all expressions in parallel
print(dd['d'])

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

teapy-0.4.23.tar.gz (161.6 kB view details)

Uploaded Source

Built Distributions

teapy-0.4.23-cp38-abi3-win_amd64.whl (12.7 MB view details)

Uploaded CPython 3.8+ Windows x86-64

teapy-0.4.23-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.4 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ x86-64

teapy-0.4.23-cp38-abi3-macosx_11_0_arm64.whl (6.6 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

teapy-0.4.23-cp38-abi3-macosx_10_7_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.8+ macOS 10.7+ x86-64

File details

Details for the file teapy-0.4.23.tar.gz.

File metadata

  • Download URL: teapy-0.4.23.tar.gz
  • Upload date:
  • Size: 161.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.0.1

File hashes

Hashes for teapy-0.4.23.tar.gz
Algorithm Hash digest
SHA256 11cbf4a6f1f583492925cc471953d654d311757571249b85db38ce1744a58dfd
MD5 607328065ce38755f53fb25ec766654d
BLAKE2b-256 848e7ab8d65f6c15859419ca04405e435f4645513cf2bb4be0dd7e336b377e75

See more details on using hashes here.

File details

Details for the file teapy-0.4.23-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: teapy-0.4.23-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 12.7 MB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.0.1

File hashes

Hashes for teapy-0.4.23-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d345457392694c1e1f0d62ce01ee44cfb3cc56dd1ceebae1780d66c5c61573e5
MD5 e46919e037bad5e0fa2a09423b0207fe
BLAKE2b-256 fb6362b7d6976c8dbb224d5901eed7158efdffc7182fdbf110e936710e08987b

See more details on using hashes here.

File details

Details for the file teapy-0.4.23-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for teapy-0.4.23-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7218a9d4dffbb3e15fa2c283e5cfd1e293b08046f5e87474ef101a835a0c38a9
MD5 1ca535a12f24d472c7f0706c80a5a3d1
BLAKE2b-256 48b3b40bcb56a0c6246d00a26a13fa5485daacaeda8eed3b2e024d7a41cc5968

See more details on using hashes here.

File details

Details for the file teapy-0.4.23-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for teapy-0.4.23-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f57f6fbff54d35e4a6ec6b76579a5064fb4e498f2b8ae6997462940b48e8cae1
MD5 99cd057d907f79cae109e2980596384a
BLAKE2b-256 d9cf6401deeb779494e4d1142a4cd42381feae568ac30e8361da9546fb332ae2

See more details on using hashes here.

File details

Details for the file teapy-0.4.23-cp38-abi3-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for teapy-0.4.23-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 c8a80621aa8e52cd692a9a7e0b22ff3d96e54d7eec5c59ee4abd7e5b44e7b197
MD5 9f6d04d77c001251378f0f32f146f879
BLAKE2b-256 42865df18b064bfd618942bfa79b3f72ec5e2e7bb3da3cd20f86800df890b8cd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page