Concurrent map utility for lists, pandas Series/DataFrames with index preservation, progress, and error inspection
Project description
maputil
A concurrent map utility for lists, pandas Series, and DataFrames. Preserves indexes and shows a progress bar. Returns a Run handle for partial results and error inspection.
Features
- Concurrent execution with threads (
concurrency) - Works with lists, Series, and DataFrames
- Preserves input indexes in the output (
pd.Series) - Progress bar (terminal and Jupyter)
- Stops scheduling on first error; inspect via
Run.get_err()
Example
from maputil import map2
def f(x):
return x + 1
r = map2(f, [10, 20, 30], concurrency=4)
r.join()
print(r.get_results()) # [11, 21, 31]
With a pandas DataFrame:
import pandas as pd
from maputil import map2
df = pd.DataFrame({"x": [1, 2, 3], "y": [10, 20, 30]}, index=[10, 20, 30])
def f(row):
return row["x"] + row["y"]
r = map2(f, df, concurrency=3)
r.join()
out = r.get_results() # pd.Series(index=[10, 20, 30], values=[11, 22, 33])
Usage
map2(fn, inputs, concurrency=1) -> RunRun.start()is idempotent;map2starts automaticallyRun.join()waits for completionRun.get_results(partial=True)returns a list orpd.SeriesRun.get_err()returns a traceback string orNone
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.4.0.tar.gz.
File metadata
- Download URL: bfg_maputil-0.4.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d0b3ce80532f1417bab56460eb732e5d169366a01173df216ecd4a159c9dc03
|
|
| MD5 |
8cb0762e145d63256150aa03cef50ef4
|
|
| BLAKE2b-256 |
c83cb53d5f613602fd4b660ce1b501d768fb11ef1639c9d2fa867fa3b15e7821
|
File details
Details for the file bfg_maputil-0.4.0-py3-none-any.whl.
File metadata
- Download URL: bfg_maputil-0.4.0-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4e98865b109ba3de69b7440c450d1da8bcb226e152cc140b8d89e48f46cc94e
|
|
| MD5 |
bd4e714410da98d0789880d3ffbaa19c
|
|
| BLAKE2b-256 |
0b5addfa960f7956d4905d061e62b8c528754e9287a4d7d8b207e9f67a6f7a06
|