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

Uploaded Source

Built Distributions

teapy-0.4.22-cp38-abi3-win_amd64.whl (12.6 MB view details)

Uploaded CPython 3.8+ Windows x86-64

teapy-0.4.22-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.4 MB view details)

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

teapy-0.4.22-cp38-abi3-macosx_11_0_arm64.whl (6.6 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

teapy-0.4.22-cp38-abi3-macosx_10_7_x86_64.whl (8.7 MB view details)

Uploaded CPython 3.8+ macOS 10.7+ x86-64

File details

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

File metadata

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

File hashes

Hashes for teapy-0.4.22.tar.gz
Algorithm Hash digest
SHA256 09526993727b626ed73d37bc556ac9749f0ed4dfe18bd72b44174ae1e9b7c3d4
MD5 ffb0d3361a752528c9518f066f49ef4c
BLAKE2b-256 3b69086eefc8860367d1503b335d33a50a710c6543b7a1e19c8fbcbbf35c4e30

See more details on using hashes here.

File details

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

File metadata

  • Download URL: teapy-0.4.22-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 12.6 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.22-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b0c53fcfd13f66d3694ec70932159d6985e3db19491fb8a2a939f9599b4b1f26
MD5 ce88163d8d57fb2e35cf08d08cae2185
BLAKE2b-256 b6f5acf976814ccf7245dce7c407e1223bb0aa7877a74bc4464a2ac7cdb8f9a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.4.22-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 400f2c25bd91b9e724106793d5ed424fac0a7c97d16d027d77c1cd9ef2f611bb
MD5 7207ded4b7a9905edb21806b2e205545
BLAKE2b-256 b8747a0f5e337b530784a163713dba20b1a7dbcfd9b15452929e80fc52caa603

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.4.22-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 54f600a84b2d96bd5eb8a347cc4988034c55b586a7f03bd4531f2dff748defa0
MD5 64a21ba517a63a0a0af80d72a505518b
BLAKE2b-256 de1bdfe4284f0e8d7bae8ab875309ffc5e727e80a49bce8507cb3118d3fc4d7a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.4.22-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 d1d141fc0bb8df66ff5fe81b380a6353757a326693cd552df2229575a615eb43
MD5 dd95105a7ecf3ad6d0230772a85ea1f9
BLAKE2b-256 8bb34520d3814588c720294b5c81558f91bf1ccdda1549fc66c83106faa91501

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