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.6.tar.gz
(140.2 kB
view hashes)
Built Distributions
Close
Hashes for teapy-0.2.6-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84f7e5289b2e497540a0a97d694a871a755903ab0461ccc507b4d6dbb807a6a5 |
|
MD5 | d3e4686e94f9efe8324c45e2df19fd7c |
|
BLAKE2b-256 | 1033ff77788b78c1d260bf6d6b12179f058b3999c541855c9049ce09bb0859fc |
Close
Hashes for teapy-0.2.6-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ece63ff4a6ea351fac9766076b5758ba30ce0d802c6049a60250c0629fecb442 |
|
MD5 | 5c2586bd2315dfaec38054aa7ae5aa3f |
|
BLAKE2b-256 | a2937af131365047c3e2e876b01941d38418da2be69cbc1e189cbdf7ea00ff55 |
Close
Hashes for teapy-0.2.6-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d2ac85149279b22ecd22dbc7eb1fd1fdb669af112f04dad70e7a4793fe67b57 |
|
MD5 | f42377d6030301a6629effd79c966397 |
|
BLAKE2b-256 | c51534d4866f16f0ca483abb8a28a6a2d81a9d993ed68f317d1e12ac966c1c98 |
Close
Hashes for teapy-0.2.6-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfd8586abf66c2d41e0165d55f383f02c1086b0bb17e9d6419ab5ef1e46b37b7 |
|
MD5 | c1d8b4dc876e91ae983e819dd1db5ef3 |
|
BLAKE2b-256 | ae45d84695f9e093d0de772aa5645e91adc80ead37e214a1cb9f7c17cb0387cd |