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

Uploaded Source

Built Distributions

teapy-0.8.0-cp38-abi3-win_amd64.whl (15.2 MB view details)

Uploaded CPython 3.8+ Windows x86-64

teapy-0.8.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.7 MB view details)

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

File details

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

File metadata

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

File hashes

Hashes for teapy-0.8.0.tar.gz
Algorithm Hash digest
SHA256 d37ec0de7ff1d3f407c28af1b72558e7e2f1099b5199dd1f5b47d5ce08cedfb0
MD5 3f7e0190439f1d6aa9599b7bad1d45ad
BLAKE2b-256 2a07bfabcf69ea9b95aa6a8838f922f79e07f5f107999cbe7d7f7e9355274e28

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for teapy-0.8.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 701a71b38ac7b7f7c79776cb27c0b2669771801fb4c56349d12674d6531b8d4e
MD5 2a29ab094adb861845a31ebf091c2d50
BLAKE2b-256 43c2d446a62f88ac162e81d8f672fe6715c4e5fb845a9c9192eadc3de559ef8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.8.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 73ce0ad5b884288133ede619cf99dad3cdf5e47a6292fe1fc411b5bf11ae587b
MD5 2bc24d16ec31e26bbc11b53f3cd1bf6d
BLAKE2b-256 4c7c3810ee7924ce7222bd1feb34cf3b4bd75ef990e6dbb1f451bd4f453f9987

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