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.0.tar.gz
(181.8 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.6.0-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 922aa9ac58905021e4259439754633ffe278357fe961c22906bf1354a249b73a |
|
MD5 | 61aa84ba64b1ebaecb8f2e6170b7c421 |
|
BLAKE2b-256 | e0208e933e04e7555bfd935c8218aecc9b920e3ae5ba0263b7d70142c70515e4 |
Close
Hashes for teapy-0.6.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86ee3ffcf1e17522753e494929bf4eddd6eee674298c73c4e369599f49da47ae |
|
MD5 | befbf39f199413c92e1cf61d8c0c0c61 |
|
BLAKE2b-256 | 69c0bd7aed0771df3993a3d1875411703cdd6e7b83bb5dd58181965fb06cb080 |
Close
Hashes for teapy-0.6.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16150a66fe3389eabcb554019247799bfea311c689502fa9e972a80c358af9d1 |
|
MD5 | 9bfa4b403671dcfc6d657ee45d8b1d31 |
|
BLAKE2b-256 | 5d38f624c6bf2eddf405dddbb092fc0f0e7f4cb7bd23aaa2e598960072eab670 |
Close
Hashes for teapy-0.6.0-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bb9bcb483fa16cbbd6d5299dd8a1863819b978c864a7f90aab63494a2b25044 |
|
MD5 | 87f3719008b60e9c2f007bbbf684c5f9 |
|
BLAKE2b-256 | a8531be9072f97e7407734c421e250d5dcca2c94b386463e4f6392c9918e68cf |