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

Uploaded Source

Built Distributions

teapy-0.3.2-cp38-abi3-win_amd64.whl (10.5 MB view details)

Uploaded CPython 3.8+ Windows x86-64

teapy-0.3.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (10.6 MB view details)

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

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

Uploaded CPython 3.8+ macOS 11.0+ ARM64

teapy-0.3.2-cp38-abi3-macosx_10_7_x86_64.whl (5.8 MB view details)

Uploaded CPython 3.8+ macOS 10.7+ x86-64

File details

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

File metadata

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

File hashes

Hashes for teapy-0.3.2.tar.gz
Algorithm Hash digest
SHA256 3a06f23202aaeea59d34dd6961e4f3a6a2be63e8638afff03f94f498ab70901c
MD5 74cfa50ed1e48c91bda60180dbf2ac74
BLAKE2b-256 0cc22af5d6c51c6b34705021fae22e1a3d44d753fbac0c03e824284cf95bb58c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: teapy-0.3.2-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 10.5 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.2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 7e6e335c08dceb07fb9ba2c9a8dfece8290130c02fdfbd3c1eb88f3dcb978b78
MD5 a613358d1bf1c48719f8f58c305211e5
BLAKE2b-256 8331a4af18b66602e56f393258988dda5890aa837297ced3fb9a3a8cbd6b65f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.3.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6c6a3ef3737c7a0040a4ff2de9a9347fb1362a4d07c62b412077b12f24cc4d67
MD5 fc2d138e88ca688880d5be0cda646747
BLAKE2b-256 ad8ac0f947d52abd18699fa31a4977e16c95821bcf7c9731485079b1f4ccb23c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.3.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0d617c8c9ae26ed1b94d29ad584fbb48b6cbc1dd25cc1fa6bce516fb4c1ec04c
MD5 babb8e2ce7e3d81c48d3d96861df577f
BLAKE2b-256 f18e120f40d41282f9b31c0f3810fc6943fac3f706b7e92c9d37767c830f9778

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.3.2-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 4d78c2f6718d7f86fd541644ece9cfbf5720e059e3e6d329b03da5d7d3fdba8b
MD5 3313d8d7a2655c13a13a56aaa9a7f5c5
BLAKE2b-256 68cc77e04e5a8e3841644ff2fe04450157a6736feac53bcbf65fb09378497a1d

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