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

Uploaded Source

Built Distributions

teapy-0.6.3-cp38-abi3-win_amd64.whl (17.8 MB view details)

Uploaded CPython 3.8+ Windows x86-64

teapy-0.6.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.1 MB view details)

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

teapy-0.6.3-cp38-abi3-macosx_11_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

teapy-0.6.3-cp38-abi3-macosx_10_7_x86_64.whl (12.5 MB view details)

Uploaded CPython 3.8+ macOS 10.7+ x86-64

File details

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

File metadata

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

File hashes

Hashes for teapy-0.6.3.tar.gz
Algorithm Hash digest
SHA256 1b5b6962cd6044c97b6d8d4370187cfbd58f7f107b367649ae5c4c9be6fc2929
MD5 5a98c6123737f0017025e6938c80dcf1
BLAKE2b-256 d5f67e5757e52aea92895bb3d418270bb75e17379e7f618157f3116cfee8ee73

See more details on using hashes here.

File details

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

File metadata

  • Download URL: teapy-0.6.3-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 17.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.6.3-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 45113aa419f3c99ec4e6e9ad6791a8e2e99bce9208d00bd9898edb5974cc33ed
MD5 8b3c3a527bb4d0e173c97658d090df8c
BLAKE2b-256 5da5c23268177740a96cf70d1d1597321f5d269be986a769a25fc291c7c917d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.6.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6c09a097d35936d7b40e526644642ee165d9791189ebe928c2dd9f0a23a1828a
MD5 7782901e7561b631e1ea8af074882655
BLAKE2b-256 bfa0f4ba7d2f438671053742632d5ef84c2cb547a172d6ce3bd27b0badc8808a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.6.3-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c6a5285b4f5211fd6b68545a8d78b309dc426064d95b2d27ab877ff2c1f26148
MD5 536e25ca3672e309df4bdb978d7a572f
BLAKE2b-256 1fa6976fcbd825ad39c39a5de6ac7a3c328a398a08274020efb21b04c07dc9d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.6.3-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 823a81be615dc64e63b5738339dbd1c417641038bb54657f4948ad904a9f71f2
MD5 48e5086b1952576b8a7cf338566ef117
BLAKE2b-256 e62c6c4cd51423fef07754511788646132824f8243dbff39f9396b334f3259c2

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