Collection.filter#
- classmethod Collection.filter( ) CollectionFilterResult[Self][source]#
Filter the members data frame by their schemas and the collection’s filters.
- Parameters:
data – The members of the collection which ought to be filtered. The dictionary must contain exactly one entry per member with the name of the member as key, except for optional members which may be missing. All data frames passed here will be eagerly collected within the method, regardless of whether they are a
DataFrameorLazyFrame.cast – Whether columns with a wrong data type in the member data frame are cast to their schemas’ defined data types if possible.
eager – Whether the filter operation should be performed eagerly. Note that until pola-rs/polars#24129 is released, eagerly filtering can provide significant speedups.
- Returns:
A named tuple with fields
resultandfailure. Theresultfield provides a collection with all members filtered for the rows passing validation. Just like for validation, all members are guaranteed to maintain their input order. Thefailurefield provides a dictionary mapping member names to their respective failure information.- Raises:
ValueError – If an insufficient set of input data frames is provided, i.e. if any required member of this collection is missing in the input.