{"id":21556,"library":"mapply","title":"mapply","description":"Sensible multi-core apply function for Pandas. Currently version 0.2.0, supporting Pandas v3 (last version supporting Pandas v2 is 0.1.31). Active development with frequent releases.","status":"active","version":"0.2.0","language":"python","source_language":"en","source_url":"https://github.com/ddelange/mapply","tags":["pandas","multiprocessing","parallel","apply","dataframe"],"install":[{"cmd":"pip install mapply","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"mapply is a top-level module that monkey-patches pandas; you import it, not a specific class.","wrong":"from mapply import mapply","symbol":"mapply","correct":"import mapply"}],"quickstart":{"code":"import pandas as pd\nimport mapply\n\nmapply.init(n_workers=-1)  # use all CPUs\n\ndf = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]})\nresult = df.mapply(lambda row: row['a'] + row['b'], axis=1)\nprint(result)","lang":"python","description":"Initialize mapply with all CPUs, then use .mapply() like .apply() but parallel."},"warnings":[{"fix":"Pin mapply<0.2.0 if using Pandas v2, or upgrade to Pandas v3.","message":"mapply 0.2.0 drops support for Pandas v2. Pandas v3+ is required. Last compatible version is 0.1.31.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Always pin mapply>=0.1.24.","message":"mapply 0.1.24+ declares pandas as a dependency. Older versions lack this, causing resolvers to pair with incompatible pandas versions.","severity":"deprecated","affected_versions":"<0.1.24"},{"fix":"Always import mapply at the top of your script, before any pandas calls.","message":"mapply must be imported before any pandas operations. Importing after creating DataFrames will not apply the monkey-patch.","severity":"gotcha","affected_versions":"all"},{"fix":"Call mapply.init(n_workers=..., pool_class='ThreadPool') for I/O-bound tasks.","message":"By default mapply uses multiprocessing (Pool). For multithreading, set POOL_CLASS to ThreadPool via mapply.init(pool_class='ThreadPool').","severity":"gotcha","affected_versions":">=0.1.29"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Add 'import mapply' at the top of your script, before any pandas DataFrame creation.","cause":"mapply not imported or imported after DataFrame already created.","error":"AttributeError: 'DataFrame' object has no attribute 'mapply'"},{"fix":"Run: pip install mapply","cause":"mapply is not installed.","error":"ModuleNotFoundError: No module named 'mapply'"},{"fix":"Use n_workers=-1 for all CPUs, or an integer >= 1.","cause":"Passing invalid value to mapply.init(n_workers=...).","error":"ValueError: n_workers must be >= 1 or -1 for all CPUs"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}