Path: blob/main/crates/polars-plan/src/dsl/functions/index.rs
6940 views
use super::*;12/// Find the indexes that would sort these series in order of appearance.3///4/// That means that the first `Series` will be used to determine the ordering5/// until duplicates are found. Once duplicates are found, the next `Series` will6/// be used and so on.7#[cfg(feature = "range")]8pub fn arg_sort_by<E: AsRef<[Expr]>>(by: E, sort_options: SortMultipleOptions) -> Expr {9let e = &by.as_ref()[0];10let name = expr_output_name(e).unwrap();11int_range(lit(0 as IdxSize), len().cast(IDX_DTYPE), 1, IDX_DTYPE)12.sort_by(by, sort_options)13.alias(name)14}1516#[cfg(feature = "arg_where")]17/// Get the indices where `condition` evaluates `true`.18pub fn arg_where<E: Into<Expr>>(condition: E) -> Expr {19condition.into().map_unary(FunctionExpr::ArgWhere)20}212223