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.3.tar.gz
(137.2 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.2.3-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abd67c477a68763b000d1c559a8f47a74a66178d0c73f36c80189d50815703c0 |
|
MD5 | c63be9869cd43777927663360dd3a66a |
|
BLAKE2b-256 | 151645003de1ea026c3f48a62dd335e128c4272d8f5ef77eba5311072b26a9a7 |
Close
Hashes for teapy-0.2.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 338eb9a6300cecd427690e83c2940590d105ed953c8f43f7f1c307a0d1e7ac12 |
|
MD5 | 7bba9aec63d71dd141e42914b48fb7dc |
|
BLAKE2b-256 | 0364cb23a766b7c5d9e65a4fddf1b63802cc2cead6421c688b783feddf55f059 |
Close
Hashes for teapy-0.2.3-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1389050944c014d6c6dec0f046dff4e0e58d42cf040474cb36f2ccee9f54d90 |
|
MD5 | f37e2b48e58e9b8666980e5afbe1d3e5 |
|
BLAKE2b-256 | 0356f488843740735edcc1bd9b9d79af9445a060243e68b9f504479630a15cd7 |
Close
Hashes for teapy-0.2.3-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 497e2651a3ac520d7adada0d1966e91792aca96a5bba3aaa2d3f58455962c54d |
|
MD5 | b6c8190e92113d7a49509eae24ff6f4f |
|
BLAKE2b-256 | 0a93e02bb25c711fb81873b0673646ad51a09b2fb58624719360d3ab4219f689 |