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 toTrueto display a progress bar
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bfg_maputil-0.3.0.tar.gz.
File metadata
- Download URL: bfg_maputil-0.3.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b4250eef1704e38a25d58877f1cfbb35a6d4f64b1ed7d567c7e294a0f4fcad3
|
|
| MD5 |
1bd2b17f572ebaab159653dc5200e7a1
|
|
| BLAKE2b-256 |
e8a80c5579a6afdea082add473ae68aa176ede0ad371d80b94552e1a369fb4b0
|
File details
Details for the file bfg_maputil-0.3.0-py3-none-any.whl.
File metadata
- Download URL: bfg_maputil-0.3.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5dffc6b2fe07b88ba3bf7826096e5158a61ddbb0a894119a195e75b800587568
|
|
| MD5 |
ef01578152ef3b66994be4eee0e94fbf
|
|
| BLAKE2b-256 |
583dc364f09dcb57d646f742ad867a881ff6ee149e58e4385dc29f3aac683756
|