Path: blob/main/crates/polars-plan/src/dsl/statistics.rs
6939 views
use super::*;12impl Expr {3/// Standard deviation of the values of the Series.4pub fn std(self, ddof: u8) -> Self {5AggExpr::Std(Arc::new(self), ddof).into()6}78/// Variance of the values of the Series.9pub fn var(self, ddof: u8) -> Self {10AggExpr::Var(Arc::new(self), ddof).into()11}1213/// Reduce groups to minimal value.14pub fn min(self) -> Self {15AggExpr::Min {16input: Arc::new(self),17propagate_nans: false,18}19.into()20}2122/// Reduce groups to maximum value.23pub fn max(self) -> Self {24AggExpr::Max {25input: Arc::new(self),26propagate_nans: false,27}28.into()29}3031/// Reduce groups to minimal value.32pub fn nan_min(self) -> Self {33AggExpr::Min {34input: Arc::new(self),35propagate_nans: true,36}37.into()38}3940/// Reduce groups to maximum value.41pub fn nan_max(self) -> Self {42AggExpr::Max {43input: Arc::new(self),44propagate_nans: true,45}46.into()47}4849/// Reduce groups to the mean value.50pub fn mean(self) -> Self {51AggExpr::Mean(Arc::new(self)).into()52}5354/// Reduce groups to the median value.55pub fn median(self) -> Self {56AggExpr::Median(Arc::new(self)).into()57}5859/// Reduce groups to the sum of all the values.60pub fn sum(self) -> Self {61AggExpr::Sum(Arc::new(self)).into()62}6364/// Compute the histogram of a dataset.65#[cfg(feature = "hist")]66pub fn hist(67self,68bins: Option<Expr>,69bin_count: Option<usize>,70include_category: bool,71include_breakpoint: bool,72) -> Self {73let mut input = vec![self];74input.extend(bins);7576Expr::n_ary(77FunctionExpr::Hist {78bin_count,79include_category,80include_breakpoint,81},82input,83)84}85}868788