Documentation ¶
Index ¶
- Constants
- type Histogram
- func (hist *Histogram) Add(binName string, binCount int)
- func (hist *Histogram) BinNameExists(binName string) bool
- func (hist *Histogram) BinNames() []string
- func (hist *Histogram) Inflate()
- func (hist *Histogram) ItemCounts(sortBy string) []maputil.Record
- func (hist *Histogram) Stats() point.PointSet
- func (hist *Histogram) ToTable(colNameBinName, colNameBinCount string) *table.Table
- func (hist *Histogram) TransformBinNames(xfFunc func(input string) string) *Histogram
- func (hist *Histogram) TransformBinNamesExactMatch(xfMap map[string]string) *Histogram
- func (hist *Histogram) TransformBinNamesPrefix(xfMap map[string]string) *Histogram
- func (hist *Histogram) ValueSum() int
- func (hist *Histogram) WriteTableASCII(writer io.Writer, header []string, sortBy string, inclTotal bool)
- func (hist *Histogram) WriteXLSX(filename, sheetname, colNameBinName, colNameBinCount string) error
- type HistogramSet
- func (hset *HistogramSet) Add(histName, binName string, count int)
- func (hset *HistogramSet) AddDateUidCount(dt time.Time, uid string, count int)
- func (hset *HistogramSet) BinNameExists(binName string) bool
- func (hset *HistogramSet) DatetimeKeyCount() (timeseries.TimeSeries, error)
- func (hset *HistogramSet) DatetimeKeyCountTable(interval timeutil.Interval, countColName string) (table.Table, error)
- func (hset *HistogramSet) DatetimeKeyToQuarter(name string) (*HistogramSet, error)
- func (hset *HistogramSet) HistogramBinNames(setName string) []string
- func (hset *HistogramSet) HistogramNameExists(histName string) bool
- func (hset *HistogramSet) HistogramNames() []string
- func (hset *HistogramSet) HistogramSetTimeKeyCountWriteXLSX(filename string, interval timeutil.Interval, countColName string) error
- func (hset *HistogramSet) ItemCount() uint
- func (hset *HistogramSet) ItemCounts() *Histogram
- func (hset *HistogramSet) ItemNames() []string
- func (hset *HistogramSet) LeafStats(name string) *Histogram
- func (hset *HistogramSet) ToTimeSeriesDistinct() (timeseries.TimeSeries, error)
- func (hset *HistogramSet) TransformHistogramNames(xfFunc func(input string) string) *HistogramSet
- func (hset *HistogramSet) TransformHistogramNamesExactMatch(xfMap map[string]string) *HistogramSet
- func (hset *HistogramSet) TransformHistogramNamesPrefix(xfMap map[string]string) *HistogramSet
- func (hset *HistogramSet) ValueSum() int
- func (hset *HistogramSet) WriteXLSX(path, colName1, colName2, colNameCount string) error
- type HistogramSetMetadata
- type HistogramSets
- type HistogramSetsCounts
Constants ¶
const ( SortNameAsc = maputil.SortNameAsc SortNameDesc = maputil.SortNameDesc SortValueAsc = maputil.SortValueAsc SortValueDesc = maputil.SortValueDesc )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Histogram ¶
type Histogram struct { Name string Bins map[string]int Counts map[string]int // how many items have counts. Percentages map[string]float64 BinCount uint Sum int }
Histogram stats is used to count how many times an item appears and how many times number of appearances appear.
func NewHistogram ¶
func ParseFileCSV ¶ added in v1.4.0
func ParseFileCSV(file string, name string, binNameColIdx, binFrequencyColIdx uint) (*Histogram, error)
ParseFileCSV reads a CSV using default settings of `,` separator, header row and BOM to be stripped. If you have other configurations, use `table.ReadFile()` directly and call `HistogramFromTable()`.
func ParseTable ¶ added in v1.4.0
ParseTable parses a `table.Table` to a `Histogram` given a table, binName column index and binFrequency column index. Empty rows are skipped.
func (*Histogram) BinNameExists ¶ added in v1.5.0
func (*Histogram) ItemCounts ¶ added in v1.5.0
ItemCounts returns sorted item names and values.
func (*Histogram) TransformBinNames ¶ added in v1.5.0
TransformBinNames modifies bin names and returns a new histogram.
func (*Histogram) TransformBinNamesExactMatch ¶ added in v1.5.0
TransformBinNamesExactMatch modifies bin names and returns a new histogram.
func (*Histogram) TransformBinNamesPrefix ¶ added in v1.7.2
TransformBinNamesPrefix modifies bin names and returns a new histogram.
type HistogramSet ¶
func NewHistogramSet ¶
func NewHistogramSet(name string) *HistogramSet
func NewHistogramSetWithData ¶ added in v1.5.0
func NewHistogramSetWithData(name string, data map[string]map[string]int) *HistogramSet
func (*HistogramSet) Add ¶
func (hset *HistogramSet) Add(histName, binName string, count int)
func (*HistogramSet) AddDateUidCount ¶ added in v1.5.0
func (hset *HistogramSet) AddDateUidCount(dt time.Time, uid string, count int)
func (*HistogramSet) BinNameExists ¶ added in v1.5.0
func (hset *HistogramSet) BinNameExists(binName string) bool
func (*HistogramSet) DatetimeKeyCount ¶ added in v1.7.2
func (hset *HistogramSet) DatetimeKeyCount() (timeseries.TimeSeries, error)
DatetimeKeyCount returns a TimeSeries when the first key is a RFC3339 time and a sum of items is desired per time.
func (*HistogramSet) DatetimeKeyCountTable ¶ added in v1.7.2
func (*HistogramSet) DatetimeKeyToQuarter ¶ added in v1.7.2
func (hset *HistogramSet) DatetimeKeyToQuarter(name string) (*HistogramSet, error)
DatetimeKeyToQuarter converts a HistogramSet by date to one by quarter.s.
func (*HistogramSet) HistogramBinNames ¶ added in v1.5.0
func (hset *HistogramSet) HistogramBinNames(setName string) []string
func (*HistogramSet) HistogramNameExists ¶ added in v1.5.0
func (hset *HistogramSet) HistogramNameExists(histName string) bool
func (*HistogramSet) HistogramNames ¶ added in v1.5.0
func (hset *HistogramSet) HistogramNames() []string
HistogramNames returns the number of histograms.
func (*HistogramSet) HistogramSetTimeKeyCountWriteXLSX ¶ added in v1.7.2
func (*HistogramSet) ItemCount ¶ added in v1.5.0
func (hset *HistogramSet) ItemCount() uint
ItemCount returns the number of histograms.
func (*HistogramSet) ItemCounts ¶ added in v1.5.0
func (hset *HistogramSet) ItemCounts() *Histogram
ItemCounts returns the number of histograms.
func (*HistogramSet) ItemNames ¶ added in v1.5.0
func (hset *HistogramSet) ItemNames() []string
ItemNames returns the number of histograms. Alias for `HistogramNames()`.
func (*HistogramSet) LeafStats ¶ added in v1.5.0
func (hset *HistogramSet) LeafStats(name string) *Histogram
func (*HistogramSet) ToTimeSeriesDistinct ¶ added in v1.7.0
func (hset *HistogramSet) ToTimeSeriesDistinct() (timeseries.TimeSeries, error)
func (*HistogramSet) TransformHistogramNames ¶ added in v1.5.0
func (hset *HistogramSet) TransformHistogramNames(xfFunc func(input string) string) *HistogramSet
TransformHistogramNames modifies histogram names and returns a new histogram set.
func (*HistogramSet) TransformHistogramNamesExactMatch ¶ added in v1.5.0
func (hset *HistogramSet) TransformHistogramNamesExactMatch(xfMap map[string]string) *HistogramSet
TransformHistogramNamesExactMatch modifies bin names and returns a new histogram.
func (*HistogramSet) TransformHistogramNamesPrefix ¶ added in v1.7.2
func (hset *HistogramSet) TransformHistogramNamesPrefix(xfMap map[string]string) *HistogramSet
TransformHistogramNamesPrefix modifies bin names and returns a new histogram.
func (*HistogramSet) ValueSum ¶ added in v1.6.4
func (hset *HistogramSet) ValueSum() int
func (*HistogramSet) WriteXLSX ¶ added in v1.5.0
func (hset *HistogramSet) WriteXLSX(path, colName1, colName2, colNameCount string) error
type HistogramSetMetadata ¶
type HistogramSetMetadata struct { Names []string `json:"names,omitempty"` NameCount int `json:"nameCount,omitempty"` UniqueBinCount int `json:"uniqueBinCount,omitempty"` }
func NewHistogramSetMetadata ¶
func NewHistogramSetMetadata(histSet *HistogramSet) *HistogramSetMetadata
type HistogramSets ¶ added in v1.5.0
type HistogramSets struct { Name string HistogramSetMap map[string]*HistogramSet }
func NewHistogramSets ¶ added in v1.5.0
func NewHistogramSets() *HistogramSets
func NewHistogramSetsCSVs ¶ added in v1.5.0
func NewHistogramSetsCSVs(filenames []string, key1ColIdx, key2ColIdx, uidColIdx uint) (*HistogramSets, table.Table, error)
NewHistogramSetsCSVs expects multiple files to have same columns.
func NewHistogramSetsTable ¶ added in v1.5.0
func NewHistogramSetsTable(tbl table.Table, key1ColIdx, key2ColIdx, uidColIdx uint) (*HistogramSets, error)
func (*HistogramSets) Add ¶ added in v1.5.0
func (hsets *HistogramSets) Add(setKey1, setKey2, binName string, binValue int, trimSpace bool)
func (*HistogramSets) Counts ¶ added in v1.5.0
func (hsets *HistogramSets) Counts() *HistogramSetsCounts
func (*HistogramSets) Flatten ¶ added in v1.5.0
func (hsets *HistogramSets) Flatten(name string) *HistogramSet
func (*HistogramSets) ItemCount ¶ added in v1.5.0
func (hsets *HistogramSets) ItemCount() uint
ItemCount returns the number of histogram sets.
type HistogramSetsCounts ¶ added in v1.5.0
type HistogramSetsCounts struct { UidCounts map[string]map[string]uint UidCountsKey1 map[string]uint UidCountsKey2 map[string]uint Key1Names []string Key2Names []string }
HistogramSetsCounts returns UID counts. When used with NewHistogramSetsCSV(), it can provide a sanity check for raw record counts against aggregate query values, e.g. compare counts of raw records to GROUP BY counts.
func NewHistogramSetsCounts ¶ added in v1.5.0
func NewHistogramSetsCounts(hsets HistogramSets) *HistogramSetsCounts
func (*HistogramSetsCounts) Inflate ¶ added in v1.5.0
func (hcounts *HistogramSetsCounts) Inflate()