Skip to content
Randall O'Reilly edited this page Sep 16, 2019 · 2 revisions

The agg package provides all standard aggregation functions such as Sum, Mean, Std etc. These operate over an IdxView of an etable.Table and work on both 1D and Tensor cells.

The Agg method takes an "enum" identifier for which agg to perform.

The split package has an Agg method (and variants) that applies the same aggregation over all the splits and stores the results within the Splits structure, which can then be saved back out to a Table for viewing or subsequent processing, etc.

These methods enable summary data to be easily generated.

The Desc method applies all standard aggregation functions (Sum, Mean, Median, Min, Max, etc) to a given column of data, for a one-stop description of the data.

Agg on Table (IdxView)

Just call the agg method directly -- it returns a slice to handle tensor-based columns, so you need to get the first element of return value if just a scalar column:

mean := agg.Mean(tix, "AvgSSE")[0]

Agg on Splits

Basic aggregation across splits, where byMethod is the Splits returned by split.GroupBy:

split.Agg(byMethod, "orbital_period", agg.AggMedian)

Proportion based on bool func

pctErr := agg.PropIf(ix, "SSE", func(idx int, val float64) bool {
		return val > 0
	})[0]
Clone this wiki locally