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.6.7.tar.gz
(185.9 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.6.7-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a125daf4524238e45f3fec86e4d8f6fe762fbbe31029dd07a1d04414eaf46483 |
|
MD5 | ff425987c7e918bd2fa1f3e76aa5c487 |
|
BLAKE2b-256 | 075f59b37592eb58055757e08468af422d531dc111b4255cd37ec9dd351603fd |
Close
Hashes for teapy-0.6.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05c98dbd616b29f2dd2ddf16caa0624d3c8e5b44e86b63c6977f8e43b275e3a5 |
|
MD5 | df96e1435dc8f552d3902d2677a07345 |
|
BLAKE2b-256 | 64240f367b95e4626e0a4304ad688caaacf1f187ba89dea30cee69a22a4fa834 |