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

Uploaded Source

Built Distributions

teapy-0.7.0-cp38-abi3-win_amd64.whl (18.3 MB view details)

Uploaded CPython 3.8+ Windows x86-64

teapy-0.7.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.7 MB view details)

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

teapy-0.7.0-cp38-abi3-macosx_11_0_arm64.whl (10.0 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

teapy-0.7.0-cp38-abi3-macosx_10_7_x86_64.whl (12.9 MB view details)

Uploaded CPython 3.8+ macOS 10.7+ x86-64

File details

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

File metadata

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

File hashes

Hashes for teapy-0.7.0.tar.gz
Algorithm Hash digest
SHA256 5e8ff15fc54e5b89c73a03717a030c46ab86848b202725f68d8e91d2fec286be
MD5 9bb4e75f830d0be0d05f4efecd04c313
BLAKE2b-256 dc46f619db72de13a1cf05318c5ccabe264041295134056e0087bec3601149d9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for teapy-0.7.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c07a279972fb7fe3250d8ed38c7f4c6e351c1032ab516c35156f0dbc962a3d94
MD5 18061ba5f404effb5fdf430dbe722870
BLAKE2b-256 fffe3c3ea47003d07ee19ef0cba214b4ec3123c70293ed11a7796038f98dde5e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.7.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a82ddd216a6e5713cf2842e9e3e00e4e0606b2fece5767c13b19bee0737142c5
MD5 6fd9e38eb90503da4e32f097d706e72a
BLAKE2b-256 9a7c7e92f6753967d48dce81c9758a1698ef56ad60c708673ff8504ee9084a61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.7.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 03a8350a33bcf7bdafdbe3238267ef75019f6e5cd82e8e94af12c0db846d65ec
MD5 352e80624542f07da7e810e1f6e1c9c7
BLAKE2b-256 dc8d6d64c62115698b515c75d2fcd65f11d69d169d2ee1e6a8cd143e0d1bcdbd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.7.0-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 b4cded3ae3b053bafe19ea758f626d66ac335ac29c5b33a113f8335384d1cbae
MD5 ccc68003d18de7fa88b1299a23971eb9
BLAKE2b-256 68bc6d309d6bc2f0ae771d7acc539e16555ba06d83c45c31c02ab3b82b7c5906

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