groupBy

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

README

groupBy

Overview

group by given columns in an axis and aggregate the value of other columns (like group by in SQL)

Description

group by works same as following SQL command

SELECT Column1, Column2, mean(Column3)
FROM DataTable
GROUP BY Column1, Column2
Implementation details

Input Data - map[string][]interface{} : map key is column name (in above SQL Column1, Column2 and Column3), map value are column values. Optional=False Params Index - []string : Group key of data (in above SQL they are Column1 and Column2). Aggregate - map[string]string : Map key is groupKey, map value is aggregate function. Currently support Sum, Count, Mean, Min, Max Level - int : Group level in above <0 -> group by both Column1 & Column2, 0 -> group by Column1, 1 -> group by Column2.

OutputType - map[string][]interface{} : grouped dataframe

Compliance to Spec

Rough level of compliance

100%

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type Input

type Input struct {
	Data interface{} `md:"data"`
}

func (*Input) FromMap

func (i *Input) FromMap(values map[string]interface{}) error

type Operation

type Operation struct {
	// contains filtered or unexported fields
}

func (*Operation) Eval

func (operation *Operation) Eval(inputs map[string]interface{}) (interface{}, error)

type Params

type Params struct {
	Index     []string            `md:"index"`
	Aggregate map[string][]string `md:"aggregate"`
	Level     int                 `md:"level"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL