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.3.3.tar.gz
(152.9 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.3.3-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 383830a00a4b61f18d29e87ff8fa85691d0816880d8dd2b07dfc7dff1bd409b8 |
|
MD5 | 1aa4cdb6788e2e7efe21ebc9ad067eee |
|
BLAKE2b-256 | 558fe6284ac43ac6de84b283ee45f8ab8fb9d9cfb17e9cbc5ece8cfb95470d6b |
Close
Hashes for teapy-0.3.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f20c91df321f7e1c16b2b7dd58490c906cdbde2fe28c2ba4a5fe07251d34212e |
|
MD5 | c5a1d584147ee19e473db4e7d8165d46 |
|
BLAKE2b-256 | e5d73f4f745cc99988a285f913eb1aec5e8a5927566a2c82fbc65d3fb0a62b31 |
Close
Hashes for teapy-0.3.3-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38a4fb45428e3b4f1d3eb4416437815122ed9b44a6a81d58cb4f87e1ff172399 |
|
MD5 | a561f941ece1e71cac9bdadda530a073 |
|
BLAKE2b-256 | 7cf66aca2623ccac4216b02708542143ddbb4c58c838bc1effa50dd145568d36 |
Close
Hashes for teapy-0.3.3-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 624039ff38a2139bb3d194dae256ec97cc8f1f1cdcc170e070a5b5767e603ede |
|
MD5 | 0c5b5ecac24b0c1350360fb3ffbe82fd |
|
BLAKE2b-256 | 326becf30e016979f6f6f8caa894c82342db1d87db6af9a458188e3fbda6cf42 |