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

Uploaded Source

Built Distributions

teapy-0.3.1-cp38-abi3-win_amd64.whl (10.3 MB view details)

Uploaded CPython 3.8+ Windows x86-64

teapy-0.3.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (10.5 MB view details)

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

teapy-0.3.1-cp38-abi3-macosx_11_0_arm64.whl (4.8 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

teapy-0.3.1-cp38-abi3-macosx_10_7_x86_64.whl (5.7 MB view details)

Uploaded CPython 3.8+ macOS 10.7+ x86-64

File details

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

File metadata

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

File hashes

Hashes for teapy-0.3.1.tar.gz
Algorithm Hash digest
SHA256 6941436a4e0a63a4926903d9f3d56cc04d67d780ac32d828acff21711bec3ed0
MD5 fa507848e1fbae116f8bc0d1dd876acd
BLAKE2b-256 1d2bf2b48961a3af0b38feb8199cefafd226622ccedf958b2f9efdf8c90e16d3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: teapy-0.3.1-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 10.3 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.3.1-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 400022fb0159f6e4b6efd63eea05eda10d70669e7c33ff77d7e2609f160097f7
MD5 f13e76208af75bd5b001ba2caa8e311a
BLAKE2b-256 f7d4e4a61971d8c57175d1e0bd885b496914b757447c18c997a7c18931ea22b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.3.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5bca8828f6f2371202f4080c568802fb2c4e9105a9e67789f5d43eaa6471faeb
MD5 e1e70a40a12a968162215479cf444654
BLAKE2b-256 3451c2cbe06743aa2be3bff20b100b2377b8d9dbaabab6d9f335d942ec0f70a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.3.1-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0a5bccbdc40000fadb8bf0f6d76cce0d62fa5cde061e97317758be50bd6cf39a
MD5 d4fbb93eff2ad0ed63be5577c7cc33d7
BLAKE2b-256 e91ea3d04ad5e411bba6ef026eb106e640e7f7f2ba732746b58ac0a70fbc3efc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.3.1-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 0142907e1ab3898e81e28a9a44c96bcc2d296bec7d85aaf9697ea2b844b415f1
MD5 2eff1fdfd1933f1fbadd6587c89fa74b
BLAKE2b-256 518f1dd9732f1b1e9ccd7685f87eba94756311727a9913e28d1b4650297e2574

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