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.17.tar.gz
(160.7 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.4.17-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc03443bb978f27c046a24e77f8a4712413351bb16616e16c862e90e132f948b |
|
MD5 | 685397caa0c222f74d35a132b768dca1 |
|
BLAKE2b-256 | c3e973c19bd307702dbc69bbf02309d63eed919d4e946f8b0be6e12d741481b0 |
Close
Hashes for teapy-0.4.17-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 127a82cb336cb484a8c733ce7eb5507dc665fa4ff3ba830c222be73b17434c1a |
|
MD5 | b6856bb69d7ad77be63c39654e421b66 |
|
BLAKE2b-256 | 93e473d350d6b0a12e4da58620932c579d742b2803dfb14c9276588759c5bef9 |
Close
Hashes for teapy-0.4.17-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0128c7f5ded419f3c88a6011a3fa4e8762888a2e76ee1675bd61b924eb3ed92d |
|
MD5 | c654da5c13840de54654cb217d5b9b00 |
|
BLAKE2b-256 | 8b03d8450126c00461730f5e754e068b5acbb6be7f61d2c71410ecc10b50d801 |
Close
Hashes for teapy-0.4.17-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b91d735414c079220b7ac751f64be73393b4f6860c862b781c44f13581f620b1 |
|
MD5 | 2c8ba4dc6052490be2fb5811019d363a |
|
BLAKE2b-256 | 879c3d8cb736442a368c6066a905f71a27d4d6b57ed47a6f90df4c9d71b1cd12 |