Add an example how to use executorlib with Pandas Dataframes:
import pandas
from executorlib import SingleNodeExecutor
def compute(a, b):
return (a-b) / (a+b)
df = pandas.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
df["c"] = df[["a", "b"]].apply(lambda x: compute(x.a, x.b), axis=1)
The same can be done with Executorlib using:
with SingleNodeExecutor() as exe:
df["c"] = list(exe.map(compute, df["a"], df["b"]))