A map utility function that caches results in case of failures and reruns, processes pandas Series, and supports parallelization
Project description
maputil
A powerful map function that improves on Python's built-in map function by adding caching and support for both lists and pandas Series.
Features
- Caches results in a SQLite database to avoid recomputing values if the code fails or reruns
- Works with both Python lists and pandas Series
- Preserves Series indexes in the output, making it easy to add results as a new column in a DataFrame
- Supports concurrent execution with multiple threads
- Optional progress bar
Example
from maputil import map
# With a pandas Series
inputs = pd.Series([1, 2, 3, 4, 5], index=["a", "b", "c", "d", "e"])
def f(x):
return x * 2
outputs = map(f, inputs, run="demo")
Usage
The map()
function requires a run
parameter to identify cached results. For the same run name, the function will use cached results for inputs it has seen before.
Optional parameters:
concurrency
: Number of threads to use for parallel executionprogress
: Set toTrue
to display a progress bar
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bfg_maputil-0.2.5.tar.gz
(6.0 kB
view details)
Built Distribution
File details
Details for the file bfg_maputil-0.2.5.tar.gz
.
File metadata
- Download URL: bfg_maputil-0.2.5.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
eb41c2ee3e8c8d89da3c6609ca49891571b74840271582b27a06e9916b6178f0
|
|
MD5 |
5ea70cad5852bd31050e66aded989116
|
|
BLAKE2b-256 |
1f6c91dd7fbb39e5559a56669f00b0adc8927b4e757b6222a80ede7c25d55a3b
|
File details
Details for the file bfg_maputil-0.2.5-py3-none-any.whl
.
File metadata
- Download URL: bfg_maputil-0.2.5-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
9986d01db81f24482692c84cf04494831ed620d59752aba28cb1820fa45bfddf
|
|
MD5 |
a8cf6f8c17aca221c33cebe5db45f378
|
|
BLAKE2b-256 |
8e889c0e311525e5d3b69c835f10de4c72324b5fd041e90873e0864fb77267fd
|