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.12.tar.gz
(158.1 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.4.12-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f8f1bc7651c21e92a5a13f043d655c65ef952b2273db50a1dbec12b1c7d84d5 |
|
MD5 | 649ae97543fa6e7fbc0f80492b0d8ab8 |
|
BLAKE2b-256 | 014c051af5c19a8c2e0093cd30e715f3bdf27d7ae709ec828bcf31a946eebb2d |
Close
Hashes for teapy-0.4.12-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8b977e811e78a746229a8a99566074022ff4f079a64827c5b8021f620e99a17 |
|
MD5 | 381d061954e17006b1ab2770dac399fe |
|
BLAKE2b-256 | 3ead7000515d5f35ba9efbe90fd81493a9c9934f8418bf04866d2b791b5360a0 |
Close
Hashes for teapy-0.4.12-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f195e20923d57a09475d52fdf7bb3646363cece65b0321fde84a7a1c08d415d |
|
MD5 | fb7647ec800a60e3b45d0275c1e8672f |
|
BLAKE2b-256 | c45d8022f9ff3686005fa3376f92855ed02f17c0dfaed0c2663d50d533875036 |
Close
Hashes for teapy-0.4.12-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 296d8554acaa291da1fdcb36e8396aec0c6166d8368b20f61e71d3ab01799dda |
|
MD5 | f919565955a47a44d108225d64df9002 |
|
BLAKE2b-256 | 80f10d015dea99ae948ffcd296cbb0ad6a58e911afdd2b4de3e654b0f0ef0228 |