Expr.pipe(f, *args, **kwargs)

Generic composition function to enable expression pipelining

>>> (expr
>>>  .pipe(f, *args, **kwargs)
>>>  .pipe(g, *args2, **kwargs2))

is equivalent to

>>> g(f(expr, *args, **kwargs), *args2, **kwargs2)

f : function or (function, arg_name) tuple

If the expression needs to be passed as anything other than the first argument to the function, pass a tuple with the argument name. For example, (f, ‘data’) if the function f expects a ‘data’ keyword

args : positional arguments

kwargs : keyword arguments


result : result type of passed function


>>> def foo(data, a=None, b=None):
...     pass
>>> def bar(a, b, data=None):
...     pass
>>> expr.pipe(foo, a=5, b=10)
>>> expr.pipe((bar, 'data'), 1, 2)