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 list
e2 = tp.Expr((1, 2, 3))  # Create from tuple
e3 = tp.Expr(np.array([1, 2, 3]), 'e3')  # Create from numpy.ndarray, name is e3
e4 = tp.Expr(pd.Series([1, 2, 3]))  # Create from pandas.Series
e5 = tp.Expr(pl.Series([1, 2, 3]))  # Create from 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 dictionary
dd2 = tp.DataDict([tp.Expr([1, 2], 'a'), tp.Expr([2, 3], 'b')])  # Create from 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.7.3.tar.gz (213.8 kB view details)

Uploaded Source

Built Distributions

teapy-0.7.3-cp38-abi3-win_amd64.whl (18.0 MB view details)

Uploaded CPython 3.8+ Windows x86-64

teapy-0.7.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.1 MB view details)

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

teapy-0.7.3-cp38-abi3-macosx_11_0_arm64.whl (10.9 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

teapy-0.7.3-cp38-abi3-macosx_10_12_x86_64.whl (13.2 MB view details)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: teapy-0.7.3.tar.gz
  • Upload date:
  • Size: 213.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.5.1

File hashes

Hashes for teapy-0.7.3.tar.gz
Algorithm Hash digest
SHA256 9be5d085a156fe6a5c77b8fb2f8eda67a8a7ab3b7fa932516164e5481576ffba
MD5 32267fb2611cdb7f56a339ebb8e60e34
BLAKE2b-256 614569cdda782ab10ce5415e68f2355dd380939a0a9eb48fa5d74cabc45da9bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: teapy-0.7.3-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 18.0 MB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.5.1

File hashes

Hashes for teapy-0.7.3-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d78d30e076d259efac11c4879cfa8c937590edddd11b41c17e36875ec00abfd8
MD5 f6a43d373a3d6cf2260023e8d980a8cc
BLAKE2b-256 9d3a0b75195f7237d597d6c79d0354ef7a41bb90e05acb5a10732989b34dd41c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.7.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e6446852d824ba8f0bdfaa0e0e8faab3938b9f787195ae0240607f45b747e8fe
MD5 97c6a41dc9071df20a8b889384b2232d
BLAKE2b-256 ab8aef879bc2c15fd80c0c2f8f629bacdda8a0b49bc223727f2f1402dd7d51a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.7.3-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6fa6443e70a5d4c2772ebc96a1b1c47bd229849f0f3c47d0006825eccdf03edc
MD5 3fc0a3e6f2684eee989570fc5b67d287
BLAKE2b-256 5b2f264c1f8da96b11073cfca08d7c120c2462a462623f6b21024a1b051169a7

See more details on using hashes here.

File details

Details for the file teapy-0.7.3-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for teapy-0.7.3-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6adfb0e9345c2232988ca3d3b7ff9264e649ce53ea37461e0e4de3978c68edc5
MD5 7ce01da3679685f6c345fe0b79706f1b
BLAKE2b-256 65f424e7a2fafa7fe36ee998ff3e50de0a691a5aff8f2fcef94fc10689852f73

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