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.0.tar.gz
(143.5 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.4.0-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 781e75f2c8fc530e365fc20ba5c128c2c95c4e288e919377ee0fb9bb25383604 |
|
MD5 | 86639f8939f298ce444ea7c19a5cba66 |
|
BLAKE2b-256 | 3034f172b6998114d5e9abba0ede0e2d698b16634c88279661f22001845505dc |
Close
Hashes for teapy-0.4.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9def50660d07ce94129353bacbbf8268f7bcc595e9b7a8cf86f6637c3443b86b |
|
MD5 | af1aeb1f6c31be555f215421ae557c10 |
|
BLAKE2b-256 | 3b169aa25f5da3d0a3be0c20448b606328560a30eff391ebe5f909dc2bc597e9 |
Close
Hashes for teapy-0.4.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 814e6d7d2f93f4a99e8759b182b715c2af23fc904eeed31b86d346e2d4c0c279 |
|
MD5 | b9aa50ad4d050b069331a9541ac2a7d5 |
|
BLAKE2b-256 | a43af0d03dd017376526cfa953d40e531af2e2f20022e5bad9ce58a6780b7db7 |
Close
Hashes for teapy-0.4.0-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ceb32ccb01d440d4fd332d4564da0d90d6ae24b162118f096e63f137fe5b3ea |
|
MD5 | cb4574e9bc0e8c2da77fb102c283f98e |
|
BLAKE2b-256 | bd190f2611a45ff5722232dd228b3d1ffca9ebc77d84b71a02c79159d2250835 |