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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

teapy-0.9.0-cp38-abi3-win_amd64.whl (13.2 MB view details)

Uploaded CPython 3.8+Windows x86-64

teapy-0.9.0-cp38-abi3-manylinux_2_34_x86_64.whl (15.9 MB view details)

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

teapy-0.9.0-cp38-abi3-macosx_11_0_arm64.whl (9.1 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for teapy-0.9.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 3b64c1b273c3eed9506c9ba2fd6041ba81d8e2c1ede5d380437f90ab30679296
MD5 bf898a700909bdcfde4bbe28e2641443
BLAKE2b-256 d0059b8a0edd9e502bde4f63c6d25e63b9f1f8bb0b334608cd0cc1a94951e9a4

See more details on using hashes here.

File details

Details for the file teapy-0.9.0-cp38-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for teapy-0.9.0-cp38-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 95bbc3bb3f3d2cca07d09fd45219f74bb684fcdebfb0b37a1f24e51049a51867
MD5 a3367b9870ff2f664bfe329b1abc12ff
BLAKE2b-256 1bca6318eef10fe763a4ec22211f76381dc39029abe82273fb80773b8a5f3dd7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.9.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8a408c5b502a0d51d8f9ed2b69ab3bcf58da791e5ad5da9fb495feabc199b23c
MD5 d1cb0cd5c92544fec0494a1b63689e08
BLAKE2b-256 6ad77c3640ee91af055f139cf5bb202a417b419dcb52f41cfd155c1826c8425d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page