table

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package table provides functionality for working with tables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

type Reader interface {
	ReadColumns(columns []string) (*Table, error)
	ReadLabels(column string) ([]string, error)
}

Reader is an interface that provides methods for reading data into a Table.

ReadColumns reads the data for the specified columns into a new Table. If an error occurs during reading, it is returned.

ReadLabels reads the labels for the specified column into a slice of strings. If an error occurs during reading, it is returned.

type Table

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

Table represents a table of data with columns and rows.

func New

func New(columns []string, rows int) *Table

New creates a new Table with the given column names and number of rows. The data slice is initialized to all zeros.

func NewWithData

func NewWithData(columns []string, data []float64) (*Table, error)

NewWithData creates a new Table from the given column names and data. If the length of the columns slice is zero, an error is returned. If the length of the data slice is not a multiple of the length of the columns slice, an error is returned.

func (*Table) Column

func (t *Table) Column(col string) int

Column returns the index of the column with the given name. If the column is not found, -1 is returned.

func (*Table) ColumnNames

func (t *Table) ColumnNames() []string

func (*Table) Columns

func (t *Table) Columns() int

func (*Table) Data

func (t *Table) Data() []float64

func (*Table) DeNormalizeColumn

func (t *Table) DeNormalizeColumn(col int, n norm.Normalizer)

func (*Table) Get

func (t *Table) Get(row, col int) float64

Get returns the value at the given row and column in the table.

func (*Table) GetRow

func (t *Table) GetRow(row int) []float64

GetRow returns a slice containing the values for the given row in the table.

func (*Table) MeanStdDev

func (t *Table) MeanStdDev(col int) (float64, float64)

func (*Table) NormalizeColumn

func (t *Table) NormalizeColumn(col int, n norm.Normalizer)

func (*Table) Range

func (t *Table) Range(col int) (min, max float64)

func (*Table) Rows

func (t *Table) Rows() int

func (*Table) Set

func (t *Table) Set(row, col int, value float64)

Set sets the value at the given row and column in the table.

Jump to

Keyboard shortcuts

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