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.2.8.tar.gz
(140.8 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.2.8-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53e28a3ce381c3abb450110c9ee3116c3f67c7dbf7d8fd045aa1d62de260048e |
|
MD5 | 532579d7f4ec7df778898ecbf6e3d38f |
|
BLAKE2b-256 | 2e4d0bc14949439bec7bf71d805c432a35ce02940693606549592aadd6de1130 |
Close
Hashes for teapy-0.2.8-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bbea31febeadc6081fdcf8b9cb55f8dba8442f662064191cdad37e2aca2313f |
|
MD5 | c3459cc526b0915d138b2fb8dab3a601 |
|
BLAKE2b-256 | 44de10bec87a7ccce17596caf4054977eb7199b4f5f58f612eb290d9a23b6f1e |
Close
Hashes for teapy-0.2.8-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a24c5131012f689577f55265a828cfe1e5ee00401c4a7407f821ae82e1beaa15 |
|
MD5 | 888d806444d471bd9aa43392d9c278ac |
|
BLAKE2b-256 | 5cee301dc71a03b5998ffd9d4db351c076cc742e1e3219b3ee4d299d7440057f |
Close
Hashes for teapy-0.2.8-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d1ce66849b37bf6f6d009d58af6c315070c2f8ac87dc4917794344c4f221c6f |
|
MD5 | a51eb66b4f50c49d7215141208dc31f3 |
|
BLAKE2b-256 | 794afab902a86256f3786e3bdc182f101a7b472194ed60d7a70c3c6522bfad98 |