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.8.tar.gz
(155.5 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.4.8-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0700a3a79b68e2ba5bba20ca04bbd7963fc1d4aa2ea2cf767d18fbcbd111ae4 |
|
MD5 | 113299cc1e06fbe18f811011b21d2a65 |
|
BLAKE2b-256 | 925ca19c83af916a7aec0e480a713aed8006705c78402f6ec244b1f3faf46ff9 |
Close
Hashes for teapy-0.4.8-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34a2f6105b07bb4fea71dbcec8531a410b08dae3aafa8e39faa756fc099d0ed4 |
|
MD5 | 6bfda3924c1d69f5fef58d36612b147b |
|
BLAKE2b-256 | 25f6ef168619eeae98956f902366b2a0efde033ac7b2a9697e244788da217638 |
Close
Hashes for teapy-0.4.8-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8493222d6b39f1b9f6efd0808387676a73a56891cdb60bc895bf2dd2fcacd761 |
|
MD5 | 30d46e7903a96932d30fd2bbf3eb7c3e |
|
BLAKE2b-256 | 072f5bd44c54b202d6a2b77461a8469455f2dd80b4a2c5d40b253c29c79c3422 |
Close
Hashes for teapy-0.4.8-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97a06a0103190c8ff8e3af33a52f810b72a403f3209e5cc54165bb737515fffd |
|
MD5 | 50a27c55a2339407364f7e2a69a7b246 |
|
BLAKE2b-256 | fa8d252637a37a2d2eb9a4d6e6dbb1f108baf764bf6679a06fa3a52ec5545a6a |