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

Uploaded Source

Built Distributions

teapy-0.2.5-cp38-abi3-win_amd64.whl (9.8 MB view details)

Uploaded CPython 3.8+ Windows x86-64

teapy-0.2.5-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (10.1 MB view details)

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

teapy-0.2.5-cp38-abi3-macosx_11_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

teapy-0.2.5-cp38-abi3-macosx_10_7_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.8+ macOS 10.7+ x86-64

File details

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

File metadata

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

File hashes

Hashes for teapy-0.2.5.tar.gz
Algorithm Hash digest
SHA256 9644943e42b01950ea6f72f4c9a24f61beb4a1cf3b01e0c4d3133544808f9566
MD5 2ffd0ad4826904992f62087dee0d25b1
BLAKE2b-256 495062e891f91705e9b452d92e08944cb0c73a824b30a1cd034a9d9fda1738b0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: teapy-0.2.5-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 9.8 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.2.5-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c7ff6b95d6d54fe8a4d5873477f3abdca16573c4356600c43f2b0a37cacffe2f
MD5 841caeadc70dfa27049a83d4ca36326c
BLAKE2b-256 26edd92c3e512786a76542743c4e70dd5b229b59fcbfe8eac08b807a02da2fab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.2.5-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0e33810c0c574e426fcf2a4d21fbf0c5346767d07037c71bb04cfce6e7f89b6f
MD5 10e9ce7f76e5eb17d49939e69e6dfe0a
BLAKE2b-256 2d1c8d1ba2e59ca812394f3934aee283491fafb617fead0913624eb29ac72688

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.2.5-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b788477ff1420571f37f10416c78caec96bcbf08b2a75ca01cda4f9b07dfda44
MD5 2ae58a98e721784d4eae40f996cd8d70
BLAKE2b-256 3249bd03be4d8508b55eda1117a8fe1d38337262c9c2e9da921ee2dd6b40a3ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teapy-0.2.5-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 ee9f15fdc1bdf7c182e3dd2f8c3050ed5132b63ec287b8276fd39598e89806e0
MD5 b180534bdf4f1de1ceb3b1b48f8f710d
BLAKE2b-256 6aff0357785bba8433974eeb73fd84db5a9042670d50f2ba210945ecaef6ea03

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