Module Talon.Agg

Column-wise aggregation operations.

All numeric aggregations coerce any numeric column to float, eliminating the need for type-specific sub-modules.

Scalar aggregations

These reduce a column to a single scalar value.

val sum : t -> string -> float

sum df name is the sum of non-null values in column name as float.

val mean : t -> string -> float

mean df name is the arithmetic mean of non-null values in column name.

val std : t -> string -> float

std df name is the population standard deviation of column name (divides by n, not n-1).

val var : t -> string -> float

var df name is the population variance of column name (divides by n, not n-1).

val min : t -> string -> float option

min df name is the minimum non-null value, or None if the column is empty or all null.

val max : t -> string -> float option

max df name is the maximum non-null value, or None if the column is empty or all null.

val median : t -> string -> float

median df name is the median (50th percentile) of column name.

val quantile : t -> string -> q:float -> float

quantile df name ~q is the q-th quantile of column name (q in [0;1]).

Generic aggregations

val count : t -> string -> int

count df name is the number of non-null values in column name.

val nunique : t -> string -> int

nunique df name is the number of unique non-null values in column name.

Row-wise (horizontal) aggregations

These compute aggregations across columns for each row.

val row_sum : ?skipna:bool -> t -> names:string list -> Col.t

row_sum ?skipna df ~names is the row-wise sum across the named columns. skipna defaults to true: skip null values. When false, any null in a row makes the entire row result null.

val row_mean : ?skipna:bool -> t -> names:string list -> Col.t

row_mean ?skipna df ~names is the row-wise mean across the named columns. skipna defaults to true.

val row_min : ?skipna:bool -> t -> names:string list -> Col.t

row_min ?skipna df ~names is the row-wise minimum across the named columns. skipna defaults to true.

val row_max : ?skipna:bool -> t -> names:string list -> Col.t

row_max ?skipna df ~names is the row-wise maximum across the named columns. skipna defaults to true.

val dot : t -> names:string list -> weights:float array -> Col.t

dot df ~names ~weights is the weighted sum (dot product) across the named columns for each row.

weights must have the same length as names. Raises Invalid_argument if lengths differ or columns are not numeric.

val row_all : t -> names:string list -> Col.t

row_all df ~names is the row-wise logical AND across the named boolean columns.

Each row is true only if all values are Some true. None and Some false both count as false. Raises Invalid_argument if any column is not boolean or does not exist.

val row_any : t -> names:string list -> Col.t

row_any df ~names is the row-wise logical OR across the named boolean columns.

Each row is true if any value is Some true. Raises Invalid_argument if any column is not boolean or does not exist.

String aggregations

module String : sig ... end

Boolean aggregations

module Bool : sig ... end