Skip to content

GroupBy ​

Namespace: Polars.FSharp

Intermediate builder for eager GroupBy operations. Under the hood, this routes through the Lazy engine to maximize performance.

Constructors & Static Methods ​

new ​

fsharp
new(df: DataFrame, groupByType: GroupByType, keys: Expr[]) : GroupBy

Parameters

NameTypeDescription
dfDataFrame-
groupByTypeGroupByType-
keysExpr[]-

Instance Methods ​

Agg ​

Aggregate columns using the provided expressions.

fsharp
member Agg(aggs: seq<Expr>) : DataFrame
member Agg([<ParamArray>] aggs: Expr[]) : DataFrame

Parameters

NameTypeDescription
aggsseq<Expr> / Expr[]-

All ​

Get all columns as lists.

fsharp
member All : unit -> DataFrame

Count ​

Count the number of rows in each group.

fsharp
member Count : unit -> DataFrame

First ​

Get the first value in each group.

fsharp
member First(?ignoreNulls: bool) : DataFrame

Parameters

NameTypeDescription
ignoreNullsbool (optional)-

Having ​

Filter groups with a predicate after aggregation.

fsharp
member Having(predicate: Expr) : GroupBy

Parameters

NameTypeDescription
predicateExpr-

Get the first n rows of each group.

fsharp
member Head(?n: int) : DataFrame

Parameters

NameTypeDescription
nint (optional)-

Last ​

Get the last value in each group.

fsharp
member Last(?ignoreNulls: bool) : DataFrame

Parameters

NameTypeDescription
ignoreNullsbool (optional)-

Len ​

Get the length of each group.

fsharp
member Len(?name: string) : DataFrame

Parameters

NameTypeDescription
namestring (optional)-

Max ​

Get the maximum value in each group.

fsharp
member Max : unit -> DataFrame

Mean ​

Get the mean value in each group.

fsharp
member Mean : unit -> DataFrame

Median ​

Get the median value in each group.

fsharp
member Median : unit -> DataFrame

Min ​

Get the minimum value in each group.

fsharp
member Min : unit -> DataFrame

NUnique ​

Count the number of unique values in each group.

fsharp
member NUnique : unit -> DataFrame

Quantile ​

Get the quantile value in each group.

fsharp
member Quantile(quantile: float, ?interpolation: QuantileMethod) : DataFrame

Parameters

NameTypeDescription
quantilefloat-
interpolationQuantileMethod (optional)-

Sum ​

Get the sum of values in each group.

fsharp
member Sum : unit -> DataFrame

Tail ​

Get the last n rows of each group.

fsharp
member Tail(?n: int) : DataFrame

Parameters

NameTypeDescription
nint (optional)-

Released under the MIT License. Powered by the Polars Rust core & Apache Arrow.