Collection.pipe#

Collection.pipe(function: ~collections.abc.Callable[[~typing.Concatenate[~typing.Self, ~P]], ~dataframely.collection.collection.T], *args: ~typing.~P, **kwargs: ~typing.~P) T[source]#

Apply a function to this collection.

This method allows chaining operations on a collection in a fluent style, analogously to polars.LazyFrame.pipe().

Parameters:
  • function – The callable to apply. It receives this collection as its first argument, followed by any additional args and kwargs.

  • args – Additional positional arguments to pass to function.

  • kwargs – Additional keyword arguments to pass to function.

Returns:

The return value of function when called as described.

Example

>>> def add_prefix(collection: MyCollection, prefix: str) -> MyCollection:
...     ...
>>> result = my_collection.pipe(add_prefix, prefix="foo")