MCPcopy Create free account
hub / github.com/cogentcore/core / AggByColumnName

Method AggByColumnName

tensor/table/splits.go:351–371  ·  view source on GitHub ↗

AggByColumnName returns Agg results for given column name, optionally including :Name agg name appended, where Name is the name given to the Agg result (e.g., Mean for a standard Mean agg). Returns nil if not found. See also Try version for error message.

(name string)

Source from the content-addressed store, hash-verified

349// appended, where Name is the name given to the Agg result (e.g., Mean for a standard Mean agg).
350// Returns nil if not found. See also Try version for error message.
351func (spl *Splits) AggByColumnName(name string) *SplitAgg {
352 dt := spl.Table()
353 if dt == nil {
354 return nil
355 }
356 nmsp := strings.Split(name, ":")
357 colIndex := dt.ColumnIndex(nmsp[0])
358 if colIndex == -1 {
359 return nil
360 }
361 for _, ag := range spl.Aggs {
362 if ag.ColumnIndex != colIndex {
363 continue
364 }
365 if len(nmsp) == 2 && nmsp[1] != ag.Name {
366 continue
367 }
368 return ag
369 }
370 return nil
371}
372
373// AggByColumnNameTry returns Agg results for given column name, optionally including :Name agg name
374// appended, where Name is the name given to the Agg result (e.g., Mean for a standard Mean agg).

Callers 2

AggByColumnNameTryMethod · 0.95
AnalyzePlanetsFunction · 0.80

Calls 3

TableMethod · 0.95
SplitMethod · 0.80
ColumnIndexMethod · 0.80

Tested by

no test coverage detected