- LazyFrame.map(f: Callable[[DataFrame], DataFrame], predicate_pushdown: bool = True, projection_pushdown: bool = True, slice_pushdown: bool = True, no_optimizations: bool = False, schema: Union[None, Dict[str, Union[Type[DataType], DataType]]] = None, validate_output_schema: bool = True) LDF #
Apply a custom function.
It is important that the function returns a Polars DataFrame.
Lambda/ function to apply.
Allow predicate pushdown optimization to pass this node.
Allow projection pushdown optimization to pass this node.
Allow slice pushdown optimization to pass this node.
Turn off all optimizations past this point.
Output schema of the function, if set to
Nonewe assume that the schema will remain unchanged by the applied function.
It is paramount that polars’ schema is correct. This flag will ensure that the output schema of this function will be checked with the expected schema. Setting this to
Falsewill not do this check, but may lead to hard to debug bugs.
schemaof a LazyFrame must always be correct. It is up to the caller of this function to ensure that this invariant is upheld.
It is important that the optimization flags are correct. If the custom function for instance does an aggregation of a column,
predicate_pushdownshould not be allowed, as this prunes rows and will influence your aggregation results.