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.4.3.tar.gz
(145.4 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.4.3-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60c90398f1b6834920cde255464368618d33e694dc08dd64ed1a790e75766fc9 |
|
MD5 | b3f0dfacd1b331381d0b41a3cba8db1e |
|
BLAKE2b-256 | 8f24eaa0fa92918a1e5a39de38ed1ed657cdfb00830c80b5a4fa69096723a0cb |
Close
Hashes for teapy-0.4.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14d86b90fd07c36ad68f1a093830c0114bacd78f9cb8312ba62033897b9b3588 |
|
MD5 | c04dd43ae409e09f24812c175a766849 |
|
BLAKE2b-256 | 7b597e4d12fccfd91318b53a1af553fd068d088b967fb773201086b9de637eda |
Close
Hashes for teapy-0.4.3-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8df302fe0088eb870848ccc9b7da06c6f8d7ccd07b60f36d536b583c177fab34 |
|
MD5 | fee2b4cc5545a8547cb798360df672ea |
|
BLAKE2b-256 | 2efd93d91a66d1bf5b6afd312409a04f66e4d093f373dbd0acf483ba056306d9 |
Close
Hashes for teapy-0.4.3-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 772445968bede4d690239d187d1d28ce4f4b62dd6e553e19e25c2ac7e49ca4bd |
|
MD5 | 38d1e5dd662da010c1dd1c6a62fe1dce |
|
BLAKE2b-256 | 7e6f404c16365f3875caff7b212da9266bf34faa7a9d95539fc821cef322d305 |