Skip to main content

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) -> Run
  • Run.start() is idempotent; map2 starts automatically
  • Run.join() waits for completion
  • Run.get_results(partial=True) returns a list or pd.Series
  • Run.get_err() returns a traceback string or None

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.4.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bfg_maputil-0.4.0-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

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

Hashes for bfg_maputil-0.4.0.tar.gz
Algorithm Hash digest
SHA256 1d0b3ce80532f1417bab56460eb732e5d169366a01173df216ecd4a159c9dc03
MD5 8cb0762e145d63256150aa03cef50ef4
BLAKE2b-256 c83cb53d5f613602fd4b660ce1b501d768fb11ef1639c9d2fa867fa3b15e7821

See more details on using hashes here.

File details

Details for the file bfg_maputil-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for bfg_maputil-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e4e98865b109ba3de69b7440c450d1da8bcb226e152cc140b8d89e48f46cc94e
MD5 bd4e714410da98d0789880d3ffbaa19c
BLAKE2b-256 0b5addfa960f7956d4905d061e62b8c528754e9287a4d7d8b207e9f67a6f7a06

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page