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.2.tar.gz
(183.0 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.6.2-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b53c05e3be27da8e1128c7f6bc394f5923deb94403bc8ea54773b73d05cf01c |
|
MD5 | b86835299cef909b2b28ab1f574cb13c |
|
BLAKE2b-256 | 5aa6d20a9451918884415066f959ff18c8d006022d629d1776d456c1a0a6673a |
Close
Hashes for teapy-0.6.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59620f78d69dade0118d22936ef87ef80bd11f84887f3af78c6b8c6cb859c4a6 |
|
MD5 | 33fd1e936cd847537e2ec97603180f6c |
|
BLAKE2b-256 | 391438701f5dd26b14e92b2d15e91bb41fdb540c18664ba6b35fe56d0b2f9850 |
Close
Hashes for teapy-0.6.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdf0bfdb2ac6a61fc52e71977542c2ba67dccd185d80bfeb7b49a95e1f144544 |
|
MD5 | b0be8e77a4eceda952236aa9246420ad |
|
BLAKE2b-256 | 566b9fccd7f97ba0510eccbbbe2e61e015824f434ee413b3c07eaaf0064faa3f |
Close
Hashes for teapy-0.6.2-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32bb851a044c7f208dc968cd235afd3d56063ee6d4b56d7554eca18b7d096b1f |
|
MD5 | 5102b2fea646b5ce1ec5c2d9956656d0 |
|
BLAKE2b-256 | bfffae6cecadfc1bfe53858c484d320bb8f025591c768ce0fa52d0e915149531 |