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.2.tar.gz
(144.6 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.4.2-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d06923c330425a7b516e8dc5f44d464861490a61edd6fb286aaeab39e0ce7ed0 |
|
MD5 | 393945385e64cb5287e55d51b956c270 |
|
BLAKE2b-256 | da04c5e2cfb54609d0f4f8483e553d74dc7fa508f843e34815150a217ae08b43 |
Close
Hashes for teapy-0.4.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 569c9a6f2a555f9a92bef77eb4af4b8feaf9240d04ad3048deaa32763e7d8476 |
|
MD5 | 0998fa17221227048cc615b22b6a3784 |
|
BLAKE2b-256 | b42b523e8a3d4b9f64dddd19cedba384a29d15c6c34c7f2f78d32186725296dd |
Close
Hashes for teapy-0.4.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e23b1a43e3120be4c91169ca2e807237de5186cf98ea81c4b7f280156c6f1469 |
|
MD5 | f381a3f864c67ab78b8edfa64a17719a |
|
BLAKE2b-256 | 8f1c4b53f13a44b39fe5a49733ed2014e5467cd6005e56558b614339c40f9f9c |
Close
Hashes for teapy-0.4.2-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84b6747640995eb32bd1a62a4616b520cb7481745ddf215d6ebac7e924a50ece |
|
MD5 | 4bdb05d399008caf7d065225eaf47c22 |
|
BLAKE2b-256 | 3eb8ad6b0d555ec70258467bf0e27e4755dccd4be0847e620dd1236402eed4d3 |