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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8+ Windows x86-64

teapy-0.4.21-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.21-cp38-abi3-macosx_11_0_arm64.whl (6.5 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

teapy-0.4.21-cp38-abi3-macosx_10_7_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.8+ macOS 10.7+ x86-64

File details

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

File metadata

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

File hashes

Hashes for teapy-0.4.21.tar.gz
Algorithm Hash digest
SHA256 32d6e945132a46e61cdb031ef7e1ef574baead0b4aa5c1beff37c6f086f2393e
MD5 0345dd67a7396ef7a13f7db2b5f4dd08
BLAKE2b-256 614c4e61fc46554d578bd70d922f7cc837344a64254ee7a12107f1734545c9c8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: teapy-0.4.21-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.21-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 90a8beb86146b83a45951ce76e2e390bea8729639e119f9dc919377a567cf360
MD5 c1959825aa72a228a042fb2e7b5ee037
BLAKE2b-256 8e6808a03c779ce590f5375bd70156c956a745d7a89070088bf057c80ec95601

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.4.21-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7eb2b9b50d034a4343cdd3c76c33dfdc1163a298a3110a47b5554fe4d9596b1b
MD5 36ec46e3cfc76eaf17570ffdfa70be6e
BLAKE2b-256 f80e12e5969dd5c4b1ce5cd6118e9f4bbbc04198072c2da95bb3441dbc17a009

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.4.21-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ad6d648bb4fd0481f0b360021559aa7ac746aeec2c4196f7a9fe554b1e4f76dc
MD5 39e758474a6eb5c7d155d3b5f1a51fa4
BLAKE2b-256 a13fd1511f36163d31c00ac90980454761d394f9142a1cf03183ce333f77e534

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.4.21-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 d047a964aebc1dc3a20bd9bfbc8f6bd180b2bb3f2aa64aadd0900e8a50120238
MD5 6413884dd12efdd564755fd08c4d6503
BLAKE2b-256 8b2ee69a7c24610fca2f636dc6aaa7e22a76d3fb81252c457ac6c4beb5f83d4f

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