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.16.tar.gz
(159.8 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.4.16-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7aca09ad70620e45d3578e9e1f833e06fa03ade6bff1def4a19a22d396cb619e |
|
MD5 | bacc56aeafdaf4d9b82f2a458f0c3ef7 |
|
BLAKE2b-256 | 8fdb532883638b79e3cf5d38b2a23f02a5055b0c5caa77856a3cd4149553b576 |
Close
Hashes for teapy-0.4.16-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0a925d04364299fc818af6c9ae25c3d555f1dddccc83a0914f29534682410af |
|
MD5 | 20806b23346fe57640b99ea5f81fd676 |
|
BLAKE2b-256 | 4a737c13fa6a22d2a9ab9cf404238c6e6eb8a78ae7ec3d2dd19c796321dba585 |
Close
Hashes for teapy-0.4.16-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1231cfdf7c5acd34c0ef1f9266644f3fd8360860194e005a0a073773ef899f8e |
|
MD5 | 5567eae77d234fe302e1b14fbdac7a48 |
|
BLAKE2b-256 | 7e822c48bf37d0ec3e072233bf9817232590796c383c002c47267453e4f24f53 |
Close
Hashes for teapy-0.4.16-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 673a31c937081e869ad5ecd947a5e0fc99b96fe6bfb4bc23f388545826799693 |
|
MD5 | dfbdf0b7ac37dddfdd31916669a20b21 |
|
BLAKE2b-256 | ec119764442fd8ca48fa2115b1dcb66306c8457abca2b3b46c355bbca4675f63 |