Function polars::prelude::apply_multiple
source · [−]pub fn apply_multiple<F, E>(
function: F,
expr: E,
output_type: NoEq<Arc<dyn FunctionOutputField + 'static>>
) -> Expr where
F: 'static + Fn(&mut [Series]) -> Result<Series, PolarsError> + Send + Sync,
E: AsRef<[Expr]>, Expand description
Apply a function/closure over the groups of multiple columns. This should only be used in a groupby aggregation.
It is the responsibility of the caller that the schema is correct by giving the correct output_type. If None given the output type of the input expr is used.
This difference with [map_mul] is that [apply_mul] will create a separate [Series] per group.
[map_mul]should be used for operations that are independent of groups, e.g.multiply * 2, orraise to the power[apply_mul]should be used for operations that work on a group of data. e.g.sum,count, etc.