Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions dataframely/collection/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,20 +808,23 @@ def cast(cls, data: Mapping[str, FrameType], /) -> Self:

# ---------------------------------- COLLECTION ---------------------------------- #

def collect_all(self) -> Self:
def collect_all(self, **kwargs: Any) -> Self:
"""Collect all members of the collection.

This method collects all members in parallel for maximum efficiency. It is
particularly useful when :meth:`filter` is called with lazy frame inputs.

Args:
kwargs: Keyword arguments passed directly to :meth:`polars.collect_all`.

Returns:
The same collection with all members collected once. Members annotated
with :class:`~dataframely.DataFrame` are returned as DataFrames, while
members annotated with :class:`~dataframely.LazyFrame` are returned as
"shallow-lazy" frames (obtained by calling ``.collect().lazy()``).
"""
lazy_dict = self.to_dict()
dfs = pl.collect_all(lazy_dict.values())
dfs = pl.collect_all(lazy_dict.values(), **kwargs)
return self._init(dict(zip(lazy_dict, dfs)))
Comment thread
ElisabethBrockhausQC marked this conversation as resolved.
Comment thread
ElisabethBrockhausQC marked this conversation as resolved.

def pipe(
Expand Down
Loading