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.6.tar.gz
(146.1 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.4.6-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e37d6d99113e078cd5e9104128fd1ee20e7251d9d3bc6cd843a2cf30d0af66b4 |
|
MD5 | fef693c2525c24cd03473c31b812b93b |
|
BLAKE2b-256 | e91c4e1cbe7e20f9e7ab747f14e5caf3de842017c219746b2ceffbce911c70b3 |
Close
Hashes for teapy-0.4.6-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b5d6504ef8b2858c44836776618c1d577cae6ecf8e56127c2b9f04b8fe92524 |
|
MD5 | d084f307b2961d06e5f7dc141127c333 |
|
BLAKE2b-256 | 990a9aaef038bb8306033a726efdb65c604757eab4381431dec4ba1eb8e3b4e9 |
Close
Hashes for teapy-0.4.6-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7761e04ba198de7bf32903ed3019dfc8fdf004cad780ddb45f4d28dc4b8fe971 |
|
MD5 | 329f8d567955e87918ad38ade8ef7399 |
|
BLAKE2b-256 | cb6dc5f07d58f821d8b12264101f61436a30be78adeca7fcc4700d00ab1aa147 |
Close
Hashes for teapy-0.4.6-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b274351b304ad7a182508e8e1913b86995a6186c0eea73490ec047d172f78e60 |
|
MD5 | 5712566a566293f6172684d32dc7a0c0 |
|
BLAKE2b-256 | 92ec2f4b2c8fec9380a13af53cc0fa5330a0654470408606045a39c21839dfac |