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.7.tar.gz
(151.6 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.4.7-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b003acdfe49f363b2f4e04de962fcc4cb18835753bfae413edec86f6875593c |
|
MD5 | d44adb349bf10a3eee4bc67c4781af91 |
|
BLAKE2b-256 | bd6bf6001e4e2f15ab2da39fddf8d1d59e72cbb65d62af9fb3f085c9d7558379 |
Close
Hashes for teapy-0.4.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa60f8566638dd214d373651ffe1f7cad45f2f69b4bde61d0bd2703958d81136 |
|
MD5 | cc78ae425217cd09c7416d350bbd67db |
|
BLAKE2b-256 | 69437df4a4e59c1c3e7d777564212e00e1b1628eb5a63bed28afa2728046d029 |
Close
Hashes for teapy-0.4.7-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cb5109d2c7aa573b4aa7f657e9934d8ba28a1b50b18a0bcbe687385cac2b0d9 |
|
MD5 | 8bc849ff63575f3b499a722170eeb208 |
|
BLAKE2b-256 | 8e251aac71aa21674531abef9e5b6363c5c1a5a30322a9c67bebc43ec92f106d |
Close
Hashes for teapy-0.4.7-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9424c3d901acf736cb08bd2735540cf5365765f7bf7be89ddb4f39cdbac972ba |
|
MD5 | 6e8c180970e4a7a8d934244409204a26 |
|
BLAKE2b-256 | d52313e2a2193c2f2679cd86aaa29d80e2e6f3e6bf3fdc06edf8a9640c29ce86 |