Struct polars_lazy::frame::LazyGroupBy
source · pub struct LazyGroupBy {
pub logical_plan: LogicalPlan,
/* private fields */
}
Expand description
Utility struct for lazy groupby operation.
Fields§
§logical_plan: LogicalPlan
Implementations§
source§impl LazyGroupBy
impl LazyGroupBy
sourcepub fn agg<E: AsRef<[Expr]>>(self, aggs: E) -> LazyFrame
pub fn agg<E: AsRef<[Expr]>>(self, aggs: E) -> LazyFrame
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(lit(0.5), QuantileInterpolOptions::Nearest).alias("median_rain"),
])
}
Trait Implementations§
source§impl Clone for LazyGroupBy
impl Clone for LazyGroupBy
source§fn clone(&self) -> LazyGroupBy
fn clone(&self) -> LazyGroupBy
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more