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.3.4.tar.gz
(153.4 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.3.4-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fbb8fdef159398e897facfbe7ba51d62c7fc9727a3a3c4d55f16c435b8b0e34 |
|
MD5 | 3faf1f0c12e0214dae762764d4e15cf8 |
|
BLAKE2b-256 | 724f7a6db31ef8d23ef668e920119345a8630857f713b932c21c4e962492854f |
Close
Hashes for teapy-0.3.4-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66453ea6ae3b2a6188958778730dbe40735d8c8041d621e59652a7364ec81ccc |
|
MD5 | 38469e22cb43857d1c45a3de68b0847a |
|
BLAKE2b-256 | 11964c92b2619be856c9212a7f4d432fbe95f2f20c9b342605a28554af89fb18 |
Close
Hashes for teapy-0.3.4-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1abc1ba88ed54a99f8136b268bb9ece5ff776c291904b12ee9b3ebed998d147 |
|
MD5 | 65d9046d8cfd103492b286a0b3099cb1 |
|
BLAKE2b-256 | a3073d2e6d47d7ed9a40b8f607978a0331f2e5b78316f284f1a2787adf491952 |
Close
Hashes for teapy-0.3.4-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19eebef39a83efe2599ac99546f90a320276047687cdabf6a3bae47c1ba907b4 |
|
MD5 | 44c76dc756707435379763ce1a38bcaf |
|
BLAKE2b-256 | 4c17ad4f8cd5191e25df51257042a1d8bc17194306ab91d07483a1e2af9b29d9 |