Struct polars::prelude::LazyGroupBy
source · [−]pub struct LazyGroupBy { /* private fields */ }
Expand description
Utility struct for lazy groupby operation.
Implementations
sourceimpl LazyGroupBy
impl LazyGroupBy
sourcepub fn agg<E>(self, aggs: E) -> LazyFrame where
E: AsRef<[Expr]>,
pub fn agg<E>(self, aggs: E) -> LazyFrame where
E: AsRef<[Expr]>,
Group by and aggregate.
Select a column with col and choose an aggregation.
If you want to aggregate all columns use col("*")
.
Example
use polars_core::prelude::*;
use polars_lazy::prelude::*;
use polars_arrow::prelude::QuantileInterpolOptions;
fn example(df: DataFrame) -> LazyFrame {
df.lazy()
.groupby_stable([col("date")])
.agg([
col("rain").min(),
col("rain").sum(),
col("rain").quantile(0.5, QuantileInterpolOptions::Nearest).alias("median_rain"),
])
}
Auto Trait Implementations
impl !RefUnwindSafe for LazyGroupBy
impl Send for LazyGroupBy
impl Sync for LazyGroupBy
impl Unpin for LazyGroupBy
impl !UnwindSafe for LazyGroupBy
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more