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 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
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.2.2.tar.gz
(135.3 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.2.2-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61d530142a5388fd004881bcef1381ffcd731b084a869639f8bed01d1ad2316d |
|
MD5 | 17adb26bd456cb28421fec803e2b29e0 |
|
BLAKE2b-256 | b71e2aeae4fc7b7a2ea79459f25b4901fc45719cfd81cd241d7fce3fc50bd6a7 |
Close
Hashes for teapy-0.2.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 326f0b0eeed44248eaa7a3abab6467eaa46f72cb694858fe664fbd2996198f18 |
|
MD5 | 86f49c548167ba7f032c003e97cb6d6c |
|
BLAKE2b-256 | 70c552110dc7e4cbc02cda57e7e2af7fae2f25621a3de0d4741040177b2a003a |
Close
Hashes for teapy-0.2.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e1a7cdee04fdd31088acc9c44923074a65daa2635ad0d160d83c45bc5e581c4 |
|
MD5 | 9252891a73974b39292663147698ceea |
|
BLAKE2b-256 | 9a9b8bfa4f44ea26ecde6a87f343b8ff7bdf0284f50fc053750aec9df7d5e8d5 |
Close
Hashes for teapy-0.2.2-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22703915c75439ea84899f886aa5e4dfd75e533484368afafdd041d2b655d13c |
|
MD5 | ab3d38dd6234bb8ce5aa2610f44c6aaa |
|
BLAKE2b-256 | 9ef8d4cc33a0cb41f7be5771e2d23d5485942c4e6411e18142e16ed771354b51 |