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.1.tar.gz (4.5 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.1-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file bfg_maputil-0.4.1.tar.gz.

File metadata

  • Download URL: bfg_maputil-0.4.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.12

File hashes

Hashes for bfg_maputil-0.4.1.tar.gz
Algorithm Hash digest
SHA256 6f2d32494234debc6055d074c3aaeac8ace4feee042a43ea3da563ccbdddafcb
MD5 2fd452c80c5544501f28a567e241a08d
BLAKE2b-256 b426aedc2905273014d14c1b2fab4494d21ba1b839773ed024833efcf630f2af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bfg_maputil-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 010049ac4b21187c09af3380a4f7e4f4dbbd251d2b9c37ca2d0b93aa6622f79d
MD5 1ec52f1b3ad3465b13a91ac253de07a5
BLAKE2b-256 f652e651cccc065b4da9f39c93cf8085e58643550b5afd0e8e7584c558778409

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