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.6.1.tar.gz
(183.2 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.6.1-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fdb5145a53867b503641e52d9e15dd1b6cb4b701395056a776fe76a3a19163b |
|
MD5 | 5671abf71d1f2692be845463e27d8241 |
|
BLAKE2b-256 | 276226b8af844c39c4194ac32f0c537847d7ddd937b01c47323ec5854b458cfa |
Close
Hashes for teapy-0.6.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65637907027de077b9566472f37572f103d069665151dabcef5a8e73168cc437 |
|
MD5 | f45c0e9979ba68156a8e1288fcf03e06 |
|
BLAKE2b-256 | e941bc6b1b7171e822b712e2058b5f591e9d92dba258c8f44c93bd9f265bd212 |
Close
Hashes for teapy-0.6.1-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19435901c85230196ed9aa2a4cfd6d4546961234e00ee90b874b523da5471901 |
|
MD5 | 386c1e03fa98cff202fa9b6cbbf2d032 |
|
BLAKE2b-256 | 1de7701b7c0ffc735041a50d41936e88b8d54bdfb0219a74a9908b0f8e635b7d |
Close
Hashes for teapy-0.6.1-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9df10b7623d4fcf2f061a2586050b145396ee55e57ddcc25efdf4dc267babc1e |
|
MD5 | a962395aa8e7b5779b3d6e08ed16ecf6 |
|
BLAKE2b-256 | 2c998a791ea578d5f564a3b8065e97b6014d0efb293f85087e8088fe7dd3f3c5 |