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

Uploaded Source

Built Distributions

teapy-0.4.13-cp38-abi3-win_amd64.whl (12.2 MB view details)

Uploaded CPython 3.8+ Windows x86-64

teapy-0.4.13-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.3 MB view details)

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

teapy-0.4.13-cp38-abi3-macosx_11_0_arm64.whl (5.8 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

teapy-0.4.13-cp38-abi3-macosx_10_7_x86_64.whl (7.4 MB view details)

Uploaded CPython 3.8+ macOS 10.7+ x86-64

File details

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

File metadata

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

File hashes

Hashes for teapy-0.4.13.tar.gz
Algorithm Hash digest
SHA256 14355837c7a78a4547a3118128d5779a2a9a5e7c597ebecb8a521eaad6212d09
MD5 080894a9b107918d9d0ad2db7a2bd74d
BLAKE2b-256 8dfa4a8379e231291750de2478558cac312cf8ae719e85c4c8773c6329a2d42c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: teapy-0.4.13-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 12.2 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.13-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 4f7cbb019ed30815225ebdbb9a8f9e35c6e82efd0003da0267b2562e7cfec552
MD5 bfefa9280c7fcdc190a59638b61b9a62
BLAKE2b-256 fc8cdfe8096f788c4fc5fdd61bc5b83b4b94eaf87d6b07f271220a80a769a064

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.4.13-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8538009b863c2da26e62eeb45d54bf0983926bdc5e586ed9a18fe05a3691ca0f
MD5 3be2fac05b30e3971119b695d0d92985
BLAKE2b-256 ab6e4c26d75f12fb5eaacccc9e13cfc907611c08aa3738d769aa10c633b6a9c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.4.13-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ab7614c217f473863e4f8aa70b9782c2489fa58ea09ac05c854786132bcae9b7
MD5 754dc90ca8455db055999da7f7523f9e
BLAKE2b-256 80b723dbf93f8d850ab4eb0aefbb01193bf1af1930d42a7edbdaa329b467ba53

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.4.13-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 9ac851a30255842e3bf28013c985dae252a14646c86a5641a31399f7dec74f33
MD5 b22480065f7949dc10b635ed66d46d58
BLAKE2b-256 4e94d80f669d31e67fb35f987632039f442f3541bb1f9ecb1c0620c93407a68f

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