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 list
e2 = tp.Expr((1, 2, 3)) # Create from tuple
e3 = tp.Expr(np.array([1, 2, 3]), 'e3') # Create from numpy.ndarray, name is e3
e4 = tp.Expr(pd.Series([1, 2, 3])) # Create from pandas.Series
e5 = tp.Expr(pl.Series([1, 2, 3])) # Create from 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 dictionary
dd2 = tp.DataDict([tp.Expr([1, 2], 'a'), tp.Expr([2, 3], 'b')]) # Create from 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.9.tar.gz
(186.4 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.6.9-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c228e0f7f596424b3dac7c4022e155e4d9afd8752dea48e353a3674f68a58af3 |
|
MD5 | ca824c1ef016b3e8c104a813f850dc99 |
|
BLAKE2b-256 | ffc7f261d1e5cc16220ffe203382ba0b718c1d1000a5a67cf677a372ebe85e25 |
Close
Hashes for teapy-0.6.9-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ec2e4e983a794d9a164a7e71d1e637ac8216714acbbd8ef717bc2fa9cfce170 |
|
MD5 | e9f230d4ca8efa43b7da93a720fe24e6 |
|
BLAKE2b-256 | 7c02e5217adf0a8249184cae892d4647f95d726b1eb2b601184007320d6dbc4c |
Close
Hashes for teapy-0.6.9-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aafff10b653444b0c1477af978cd9deb4b1bfbf22f3468150d8d755e7e3584ba |
|
MD5 | 6302fc08921b8af507e20c6b5319ba00 |
|
BLAKE2b-256 | 0a8a0c467f54185eaeed27e8833f2363d9f9dd986505615512ab6e6250d9e466 |
Close
Hashes for teapy-0.6.9-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e2cc6cff65d89d2abc7a1b0e9888882c491912ff1e7d2d2c119ff78b3505824 |
|
MD5 | 7669c4882c63d3ff3e8f08c758ef4ea3 |
|
BLAKE2b-256 | 9eac9dc66b2733c4a2161f96b5bc7d278bd2b48a4a906c3a65fd686ef6db1818 |