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.9.tar.gz
(141.7 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.2.9-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba15e9729b667dc82d4570acd01e3c37592eb3e12e4156a209158055541a1be8 |
|
MD5 | 2561ebf900b3e70a2939146867555e68 |
|
BLAKE2b-256 | d9dda31361623cc415f623deceab80744fd584877623afa0f7d7794910c336d5 |
Close
Hashes for teapy-0.2.9-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbc6b66297c6c761be955d22aa6bc6a28767cd2da2c009057dfa375c7a128b0b |
|
MD5 | 8f4c913bf293387c786cb165ce5d5f7f |
|
BLAKE2b-256 | 7f96a3c065105a469366d1f65ce00fda81379a0fb175801452de857838319ca6 |
Close
Hashes for teapy-0.2.9-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4c5cf4960f06808fdc291657d90c02f9879b15cbefa932c285f1fb41208c7c6 |
|
MD5 | 299763f7675c49fd94caeda89aa98d0d |
|
BLAKE2b-256 | 657cb1840112c4cb54853cce4495fdbc7c4503659b1bd924793936e900969bec |
Close
Hashes for teapy-0.2.9-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aad1a40c4a900ae165383a8c77ccea050b6b7c5d622773057a0ff5f89418c510 |
|
MD5 | cfc9ccda03765c3088aa41d90c292548 |
|
BLAKE2b-256 | 78c178f131a5f68cefdb49e37bccc97879007bf83d8876a0aaa6714c4acbf549 |