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.20.tar.gz
(161.9 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.4.20-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0f53529dc3c014e33d986f41595457f6557ce8439d76d2b5ee836805034be89 |
|
MD5 | 0b8b4e45a59f2fa12ecd6187fe85c81c |
|
BLAKE2b-256 | 218a3f8cdf60931946dac4004925b9ef28ab4dfce98eb93ebd4ddd43b9ab26e2 |
Close
Hashes for teapy-0.4.20-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 234fccbf4e236750887bfa9f674257fc581a3f178efcebc9b3cede2a30867dc7 |
|
MD5 | fd322244438c50955f67ac4c2d09f07c |
|
BLAKE2b-256 | c15d55b785fce5cc5b9c82c0f1415f07f537d9427da158ec1f2ebcaee1800e6d |
Close
Hashes for teapy-0.4.20-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c592c189dbf06005efd8fed9ed182c1177e18971e3a3ecb96da29324eae2858 |
|
MD5 | ead5626152ff171293f2f33366874b70 |
|
BLAKE2b-256 | f91db315e7c557376628d1398778267c1e3296fe41b86d6165bf9d19244c57e8 |
Close
Hashes for teapy-0.4.20-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e696ed0f3bfb97537e8fa65c0bfe789bc021d1843a74b109ab7eb6e43a723a6c |
|
MD5 | ac96cc8701c74f61b12a2daf3b3594e7 |
|
BLAKE2b-256 | f1e51da15cb68f7d68c9d7450940b26535f23eb1f240fe25e4d15e46af0c3dda |