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.9.tar.gz (155.8 kB view details)

Uploaded Source

Built Distributions

teapy-0.4.9-cp38-abi3-win_amd64.whl (11.8 MB view details)

Uploaded CPython 3.8+ Windows x86-64

teapy-0.4.9-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.7 MB view details)

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

teapy-0.4.9-cp38-abi3-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

teapy-0.4.9-cp38-abi3-macosx_10_7_x86_64.whl (6.9 MB view details)

Uploaded CPython 3.8+ macOS 10.7+ x86-64

File details

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

File metadata

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

File hashes

Hashes for teapy-0.4.9.tar.gz
Algorithm Hash digest
SHA256 9042be291aec8d0413bdffe93ed444efb7a699162abbb5c35d686a4d5426dd76
MD5 f124518d6d0f64c613ce73b78801f481
BLAKE2b-256 5bd180c1e1314b2369f7ee94a120c08899c7630ff66a45e3f1686d1d9c486e34

See more details on using hashes here.

File details

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

File metadata

  • Download URL: teapy-0.4.9-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 11.8 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.9-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 303898ab807f8184e1035a4e92222341d3ae42b5a9393c38191f187155b2c99e
MD5 4ea7b9ed8c57ecf6d2282bdef25425e7
BLAKE2b-256 2a22b37b8603a0a467be34338edff1b1e86b46a0962572509d2509e953a27901

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.4.9-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 65a7c6ed0847b9f9b6d2b9f8255d9a20ae58dcdead9fae5a59d0eb80e0954ce8
MD5 c9d801a08868fa08ad6fcad839acf213
BLAKE2b-256 2a302833cb407e7126ac7b8314545650d44df080f3d4c783aba69a81e1abe1a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.4.9-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5fd5cea147cf905cac36fdff6f6c4e8b5bbd40cad946f84746238f7d58c21a37
MD5 fadbd72c2f135bc5fe6ccc7b4dd92afc
BLAKE2b-256 6b38fbf2efc12054ac08060d149e5b830d75f502ac0ec2aa3a9c7888a7c47405

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.4.9-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 1ae66802db6dd04553bcd460aabc1cf66b0b83d3814c18dba5f4777fbbe7b6f8
MD5 a3dd6bed8dcb519db095b5abf35c4483
BLAKE2b-256 96d3785e72bcaf7f5de4b29851500138a8ada06c1b0d315ffda6afa824a00a59

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