A blazingly fast datadict library
Project description
Teapy
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
Release history Release notifications | RSS feed
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.7.2.tar.gz
(214.0 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.7.2-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de2facc6601adc916dfd0b2a631cf72b94111316bd54df94cc4803e6de358c97 |
|
MD5 | dc592ce9531a88afeeb3ecbddda4f15e |
|
BLAKE2b-256 | d09c21a50b9448637020c2467f1251e9bc783d1fcb406b5a7c95af858df6d18e |
Close
Hashes for teapy-0.7.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8739f83d2c45c077bdb815d9aabf86668cd027e51a6e24a945988589c5c89b31 |
|
MD5 | 2f154add74524dda41627f31e694a262 |
|
BLAKE2b-256 | e3ada9682faf78d1afd952a6a155cfb464105e389b1035d3eccb4c12f24a213e |
Close
Hashes for teapy-0.7.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ff732b580f94ae34705834086598050c955b329e859938bdc359e8d2b7c5129 |
|
MD5 | 01203252f316f19b673b7b556069aadf |
|
BLAKE2b-256 | 2f4130e3a4eb62c6bf3aa7596c07c0625b3daff8c5d1cc28b1c8b66d40220d63 |
Close
Hashes for teapy-0.7.2-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fedc3303b65f1bea1e6e1719240e9de2f2bdcb788b621a6c75a0b7f055a1303b |
|
MD5 | 7279b3603f3ed9269089ee178ce9926e |
|
BLAKE2b-256 | 5ed54a852e4dbc9b63747f3e8765912ae4b32062bc5ef7209040b5b53c2f08ea |