dataframe package - github.com/rocketlaunchr/dataframe-go - Go Packages (original) (raw)

DontLock is short-hand for various functions that permit disabling locking.

ErrNoRows signifies that the Series, Dataframe or import data contains no rows of data.

Apply will call fn for each row in the Series or DataFrame and replace the existing value with the new value returned by fn. When sdf is a DataFrame, fn must be of type ApplyDataFrameFn. When sdf is a Series, fn must be of type ApplySeriesFn.

B converts a boolean to an int.

func BoolValueFormatter(v interface{}) string

BoolValueFormatter is used by SetValueToStringFormatter to display an int as a bool. If the encountered value is not a 0 or 1, it will panic.

func DefaultIsEqualFunc(a, b interface{}) bool

DefaultIsEqualFunc is the default comparitor to determine if two values in the series are the same.

func DefaultValueFormatter(v interface{}) string

DefaultValueFormatter will return a string representation of the data in a particular row.

Filter is used to filter particular rows in a Series or DataFrame. If the InPlace option is set, the Series or DataFrame is modified "in place" and the function returns nil. Alternatively, a new Series or DataFrame is returned.

When sdf is a DataFrame, fn must be of type FilterDataFrameFn. When sdf is a Series, fn must be of type FilterSeriesFn.

IsValidFloat64 returns true if f is neither Nan nor ±Inf. Otherwise it returns false.

type ApplyDataFrameFn func(vals map[interface{}]interface{}, row, nRows int) map[interface{}]interface{}

ApplyDataFrameFn is used by the Apply function when used with DataFrames. vals contains the values for the current row. The keys contain ints (index of Series) and strings (name of Series). The returned map must only contain what values you intend to update. The key can be a string (name of Series) or int (index of Series). If nil is returned, the existing values for the row are unchanged.

type ApplySeriesFn func(val interface{}, row, nRows int) interface{}

ApplySeriesFn is used by the Apply function when used with Series. val contains the value of the current row. The returned value is the updated value.

type AsciiGraphOptions struct {

Caption [string](/builtin#string)


Height [int](/builtin#int)


Offset [int](/builtin#int)


Width [int](/builtin#int)


R *[Range](#Range)

}

AsciiGraphOptions can be used to configure the look of the graph.

type DataFrame struct { Series []Series

}

DataFrame allows you to handle numerous series of data conveniently.

func NewDataFrame(se ...Series) *DataFrame

NewDataFrame creates a new dataframe.

func (df *DataFrame) AddSeries(s Series, colN *int, opts ...Options) error

AddSeries will add a Series to the end of the DataFrame, unless set by ColN.

func (df *DataFrame) Append(opts *Options, vals ...interface{})

Append inserts a row at the end.

func (df *DataFrame) ClearRow(row int, opts ...Options)

ClearRow makes an entire row nil.

func (df *DataFrame) Copy(r ...Range) *DataFrame

Copy will create a new copy of the Dataframe. It is recommended that you lock the Dataframe before attempting to Copy.

func (*DataFrame) FillRand

FillRand will randomly fill all the Series in the Dataframe.

func (df *DataFrame) Insert(row int, opts *Options, vals ...interface{})

Insert adds a row to a particular position.

IsEqual returns true if df2's values are equal to df.

func (df *DataFrame) Lock(deepLock ...bool)

Lock will lock the Dataframe allowing you to directly manipulate the underlying Series with confidence.

func (*DataFrame) MustNameToColumn

func (df *DataFrame) MustNameToColumn(seriesName string, opts ...Options) int

MustNameToColumn returns the index of the series based on the name. The starting index is 0. If seriesName doesn't exist it panics.

func (df *DataFrame) NRows(opts ...Options) int

NRows returns the number of rows of data. Each series must contain the same number of rows.

func (*DataFrame) NameToColumn

NameToColumn returns the index of the series based on the name. The starting index is 0.

Names will return a list of all the series names.

func (df *DataFrame) Prepend(opts *Options, vals ...interface{})

Prepend inserts a row at the beginning.

func (df *DataFrame) Remove(row int, opts ...Options)

Remove deletes a row.

RemoveSeries will remove a Series from the Dataframe.

func (*DataFrame) ReorderColumns

ReorderColumns reorders the columns based on an ordered list of column names. The length of newOrder must match the number of columns in the Dataframe. The column names in newOrder must be unique.

func (df *DataFrame) Row(row int, dontReadLock bool, retOpt ...SeriesReturnOpt) map[interface{}]interface{}

Row returns the series' values for a particular row.

Example:

df.Row(5, false, dataframe.SeriesIdx|dataframe.SeriesName)

Sort is used to sort the Dataframe according to different keys. It will return true if sorting was completed or false when the context is canceled.

String implements the fmt.Stringer interface. It does not lock the DataFrame.

func (df *DataFrame) Swap(row1, row2 int, opts ...Options)

Swap is used to swap 2 values based on their row position.

Table will produce the DataFrame in a table.

func (df *DataFrame) Unlock(deepUnlock ...bool)

Unlock will unlock the Dataframe that was previously locked.

func (df *DataFrame) Update(row int, col interface{}, val interface{}, opts ...Options)

Update is used to update a specific entry. col can be the name of the series or the column number.

func (df *DataFrame) UpdateRow(row int, opts *Options, vals ...interface{})

UpdateRow will update an entire row.

func (df DataFrame) ValuesIterator(opts ...ValuesOptions) func(opts ...SeriesReturnOpt) (int, map[interface{}]interface{}, int)

ValuesIterator will return a function that can be used to iterate through all the values.

The returned value is a map containing the name of the series (string) and the index of the series (int) as keys. You can reduce the keys in the map to only contain the series name (SeriesName) or series index (SeriesIdx).

Example:

iterator := df.ValuesIterator(dataframe.ValuesOptions{0, 1, true})

df.Lock() for { row, vals, _ := iterator(dataframe.SeriesName) if row == nil { break } fmt.Println(*row, vals) } df.Unlock()

// OR

df.Lock() row, vals, _ := iterator() for ; row != nil; row, vals, _ = iterator() { fmt.Println(*row, vals) } df.Unlock()

ErrorCollection is used to hold multiple errors.

func NewErrorCollection() *ErrorCollection

NewErrorCollection returns a new ErrorCollection. ErrorCollection is compatible with errors.Is and errors.As functions.

AddError inserts a new error to the ErrorCollection. If err is nil, the function will panic.

func (ec *ErrorCollection) As(target interface{}) bool

As returns true if ErrorCollection contains an error of the same type as target. If so, it will set target to that error.

Error implements the error interface.

Is returns true if ErrorCollection contains err.

IsNil returns whether the ErrorCollection contains any errors.

type FillRandOptions

type FillRandOptions struct {

R *[Range](#Range)


Extra interface{}

}

FillRandOptions configures how FillRand should behave.

type FillRander

FillRander is an interface for generating a Series with random values.

FilterAction is the return value of FilterSeriesFn and FilterDataFrameFn.

const (

DROP [FilterAction](#FilterAction) = 0


KEEP [FilterAction](#FilterAction) = 1


CHOOSE [FilterAction](#FilterAction) = 1

)

type FilterDataFrameFn func(vals map[interface{}]interface{}, row, nRows int) (FilterAction, error)

FilterDataFrameFn is used by the Filter function to determine which rows are selected. vals contains the values for the current row. The keys contain ints (index of Series) and strings (name of Series). If the function returns DROP, then the row is removed. If KEEP or CHOOSE is chosen, the row is kept.

type FilterOptions struct {

InPlace [bool](/builtin#bool)


DontLock [bool](/builtin#bool)

}

FilterOptions modifies the behavior of the Filter function.

type FilterSeriesFn func(val interface{}, row, nRows int) (FilterAction, error)

FilterSeriesFn is used by the Filter function to determine which rows are selected. val contains the value of the current row. If the function returns DROP, then the row is removed. If KEEP or CHOOSE is chosen, the row is kept.

type IsEqualFunc func(a, b interface{}) bool

IsEqualFunc is used to determine if a and b are considered equal.

type IsEqualOptions struct {

DontLock [bool](/builtin#bool)


CheckName [bool](/builtin#bool)

}

IsEqualOptions sets various options for the IsEqual function.

type IsLessThanFunc func(a, b interface{}) bool

IsLessThanFunc returns true if a < b

type NewSerieser interface {

NewSeries(name [string](/builtin#string), init *[SeriesInit](#SeriesInit)) [Series](#Series)

}

NewSerieser is an interface for a Series to create a new initialized Series of the same type.

NilCountOptions sets various options for the NilCount function.

type Options struct {

DontLock [bool](/builtin#bool)

}

Options sets various options.

type OrderedMapIntFloat64 struct {

}

OrderedMapIntFloat64 is an ordered map[int]float64.

func NewOrderedMapIntFloat64(notOrdered ...bool) *OrderedMapIntFloat64

NewOrderedMapIntFloat64 will create a new OrderedMapIntFloat64. By default it will be ordered, but setting notOrdered to true will make it operate as a builtin map.

func (o *OrderedMapIntFloat64) Delete(key int)

Delete will remove the key from the OrderedMapIntFloat64. For performance reasons, ensure the key exists beforehand when in ordered mode.

Get will return the value of the key. If it doesn't exist, it will return false for the second return value.

Set will set a key and value pair. It will overwrite an existing pair if it exists already.

ValuesIterator is used to iterate through the values of OrderedMapIntFloat64.

type OrderedMapIntMixed struct {

}

OrderedMapIntMixed is an ordered map[int]interface{}.

func NewOrderedMapIntMixed(notOrdered ...bool) *OrderedMapIntMixed

NewOrderedMapIntMixed will create a new OrderedMapIntMixed. By default it will be ordered, but setting notOrdered to true will make it operate as a builtin map.

func (o *OrderedMapIntMixed) Delete(key int)

Delete will remove the key from the OrderedMapIntMixed. For performance reasons, ensure the key exists beforehand when in ordered mode.

Get will return the value of the key. If it doesn't exist, it will return false for the second return value.

func (o *OrderedMapIntMixed) Set(key int, val interface{})

Set will set a key and value pair. It will overwrite an existing pair if it exists already.

func (o OrderedMapIntMixed) ValuesIterator() func() (int, interface{})

ValuesIterator is used to iterate through the values of OrderedMapIntMixed.

type Range struct { Start *int End *int }

Range is used to specify a range. Both Start and End are inclusive. A nil value means no limit, so a Start of nil means 0 and an End of nil means no limit. The End value must always be equal to or larger than Start. Negative values are acceptable. A value of -2 means the second last row.

func IntsToRanges(ints []int) []Range

IntsToRanges will convert an already (ascending) ordered list of ints to a slice of Ranges.

Example:

import "sort" ints := []int{2,4,5,6,8,10,11,45,46} sort.Ints(ints)

fmt.Println(IntsToRanges(ints)) // Output: R{2,2}, R{4,6}, R{8,8}, R{10,11}, R{45,46}

func RangeFinite(start int, end ...int) Range

RangeFinite returns a Range that has a finite span.

Limits is used to return the start and end limits of a Range object for a given Dataframe or Series with length number of rows.

NRows returns the number of rows contained by Range. If End is nil, then length must be provided.

String implements Stringer interface.

type RowError struct { Row int Err error }

RowError signifies that a particular row contained or generated an error.

Error implements the error interface.

Unwrap implements the Wrapper interface.

type Series interface {

Name(opts ...[Options](#Options)) [string](/builtin#string)


Rename(n [string](/builtin#string), opts ...[Options](#Options))


Type() [string](/builtin#string)


NRows(opts ...[Options](#Options)) [int](/builtin#int)


Value(row [int](/builtin#int), opts ...[Options](#Options)) interface{}


ValueString(row [int](/builtin#int), opts ...[Options](#Options)) [string](/builtin#string)


Prepend(val interface{}, opts ...[Options](#Options))


Append(val interface{}, opts ...[Options](#Options)) [int](/builtin#int)


Insert(row [int](/builtin#int), val interface{}, opts ...[Options](#Options))


Remove(row [int](/builtin#int), opts ...[Options](#Options))


Reset(opts ...[Options](#Options))


ValuesIterator(opts ...[ValuesOptions](#ValuesOptions)) func() (*[int](/builtin#int), interface{}, [int](/builtin#int))


Update(row [int](/builtin#int), val interface{}, opts ...[Options](#Options))


SetValueToStringFormatter(f [ValueToStringFormatter](#ValueToStringFormatter))


Sort(ctx [context](/context).[Context](/context#Context), opts ...[SortOptions](#SortOptions)) (completed [bool](/builtin#bool))


IsEqualFunc(a, b interface{}) [bool](/builtin#bool)


IsLessThanFunc(a, b interface{}) [bool](/builtin#bool)


Swap(row1, row2 [int](/builtin#int), opts ...[Options](#Options))


Lock()


Unlock()


Copy(r ...[Range](#Range)) [Series](#Series)


ContainsNil(opts ...[Options](#Options)) [bool](/builtin#bool)


NilCount(opts ...[NilCountOptions](#NilCountOptions)) ([int](/builtin#int), [error](/builtin#error))


IsEqual(ctx [context](/context).[Context](/context#Context), s2 [Series](#Series), opts ...[IsEqualOptions](#IsEqualOptions)) ([bool](/builtin#bool), [error](/builtin#error))

}

Series is a collection of data that could be of any type. It is usually used with DataFrame.

type SeriesFloat64 struct {

Values [][float64](/builtin#float64)

}

SeriesFloat64 is used for series containing float64 data.

func NewSeriesFloat64(name string, init *SeriesInit, vals ...interface{}) *SeriesFloat64

NewSeriesFloat64 creates a new series with the underlying type as float64.

func (s *SeriesFloat64) Append(val interface{}, opts ...Options) int

Append is used to set a value to the end of the series. val can be a concrete data type or nil. Nil represents the absence of a value.

AsciiGraph will produce a simple ascii based graph of the data. The function will panic if the range R is invalid.

func (s *SeriesFloat64) ContainsNil(opts ...Options) bool

ContainsNil will return whether or not the series contains any nil values.

func (s *SeriesFloat64) Copy(r ...Range) Series

Copy will create a new copy of the series. It is recommended that you lock the Series before attempting to Copy.

func (*SeriesFloat64) FillRand

FillRand will fill a Series with random data. probNil is a value between between 0 and 1 which determines if a row is given a nil value.

func (s *SeriesFloat64) Insert(row int, val interface{}, opts ...Options)

Insert is used to set a value at an arbitrary row in the series. All existing values from that row onwards are shifted by 1. val can be a concrete data type or nil. Nil represents the absence of a value.

IsEqual returns true if s2's values are equal to s.

func (s *SeriesFloat64) IsEqualFunc(a, b interface{}) bool

IsEqualFunc returns true if a is equal to b.

func (s *SeriesFloat64) IsLessThanFunc(a, b interface{}) bool

IsLessThanFunc returns true if a is less than b.

func (s *SeriesFloat64) Lock()

Lock will lock the Series allowing you to directly manipulate the underlying slice with confidence.

Mean returns the mean. All non-nil values are ignored.

func (s *SeriesFloat64) NRows(opts ...Options) int

NRows returns how many rows the series contains.

Name returns the series name.

NewSeries creates a new initialized SeriesFloat64.

NilCount will return how many nil values are in the series.

func (s *SeriesFloat64) Prepend(val interface{}, opts ...Options)

Prepend is used to set a value to the beginning of the series. val can be a concrete data type or nil. Nil represents the absence of a value.

func (s *SeriesFloat64) Remove(row int, opts ...Options)

Remove is used to delete the value of a particular row.

Rename renames the series.

func (s *SeriesFloat64) Reset(opts ...Options)

Reset is used clear all data contained in the Series.

func (s *SeriesFloat64) SetValueToStringFormatter(f ValueToStringFormatter)

SetValueToStringFormatter is used to set a function to convert the value of a particular row to a string representation.

Sort will sort the series. It will return true if sorting was completed or false when the context is canceled.

String implements the fmt.Stringer interface. It does not lock the Series.

Sum returns the sum of all non-nil values. If all values are nil, a NaN is returned. If opposing infinites are found, a NaN is also returned

func (s *SeriesFloat64) Swap(row1, row2 int, opts ...Options)

Swap is used to swap 2 values based on their row position.

Table will produce the Series in a table.

ToSeriesFloat64 will create a new SeriesFloat64. If removeNil is false, the function will simply create a copy. In the current implementation, conv is ignored. The operation does not lock the Series.

ToSeriesMixed will convert the Series to a SeriesMIxed. The operation does not lock the Series.

ToSeriesString will convert the Series to a SeriesString. The operation does not lock the Series.

Type returns the type of data the series holds.

func (s *SeriesFloat64) Unlock()

Unlock will unlock the Series that was previously locked.

func (s *SeriesFloat64) Update(row int, val interface{}, opts ...Options)

Update is used to update the value of a particular row. val can be a concrete data type or nil. Nil represents the absence of a value.

func (s *SeriesFloat64) Value(row int, opts ...Options) interface{}

Value returns the value of a particular row. The return value could be nil or the concrete type the data type held by the series. Pointers are never returned.

ValueString returns a string representation of a particular row. The string representation is defined by the function set in SetValueToStringFormatter. By default, a nil value is returned as "NaN".

func (s SeriesFloat64) ValuesIterator(opts ...ValuesOptions) func() (int, interface{}, int)

ValuesIterator will return a function that can be used to iterate through all the values.

type SeriesGeneric struct {

}

SeriesGeneric is a series of data where the contained data can be of any type. Only concrete data types can be used.

func NewSeriesGeneric(name string, concreteType interface{}, init *SeriesInit, vals ...interface{}) *SeriesGeneric

NewSeriesGeneric creates a new generic series.

func (s *SeriesGeneric) Append(val interface{}, opts ...Options) int

Append is used to set a value to the end of the series. val can be a concrete data type or nil. Nil represents the absence of a value.

func (s *SeriesGeneric) ContainsNil(opts ...Options) bool

ContainsNil will return whether or not the series contains any nil values.

func (s *SeriesGeneric) Copy(r ...Range) Series

Copy will create a new copy of the series. It is recommended that you lock the Series before attempting to Copy.

func (s *SeriesGeneric) Insert(row int, val interface{}, opts ...Options)

Insert is used to set a value at an arbitrary row in the series. All existing values from that row onwards are shifted by 1. val can be a concrete data type or nil. Nil represents the absence of a value.

IsEqual returns true if s2's values are equal to s.

func (s *SeriesGeneric) IsEqualFunc(a, b interface{}) bool

IsEqualFunc returns true if a is equal to b.

func (s *SeriesGeneric) IsLessThanFunc(a, b interface{}) bool

IsLessThanFunc returns true if a is less than b.

func (s *SeriesGeneric) Lock()

Lock will lock the Series allowing you to directly manipulate the underlying slice with confidence.

func (s *SeriesGeneric) NRows(opts ...Options) int

NRows returns how many rows the series contains.

Name returns the series name.

NilCount will return how many nil values are in the series.

func (s *SeriesGeneric) Prepend(val interface{}, opts ...Options)

Prepend is used to set a value to the beginning of the series. val can be a concrete data type or nil. Nil represents the absence of a value.

func (s *SeriesGeneric) Remove(row int, opts ...Options)

Remove is used to delete the value of a particular row.

Rename renames the series.

func (s *SeriesGeneric) Reset(opts ...Options)

Reset is used clear all data contained in the Series.

func (s *SeriesGeneric) SetIsEqualFunc(f IsEqualFunc)

SetIsEqualFunc sets a function which can be used to determine if 2 values in the series are equal.

func (s *SeriesGeneric) SetIsLessThanFunc(f IsLessThanFunc)

SetIsLessThanFunc sets a function which can be used to determine if a value is less than another in the series.

func (s *SeriesGeneric) SetValueToStringFormatter(f ValueToStringFormatter)

SetValueToStringFormatter is used to set a function to convert the value of a particular row to a string representation.

Sort will sort the series. It will return true if sorting was completed or false when the context is canceled.

String implements the fmt.Stringer interface. It does not lock the Series.

func (s *SeriesGeneric) Swap(row1, row2 int, opts ...Options)

Swap is used to swap 2 values based on their row position.

Table will produce the Series in a table.

ToSeriesMixed will convert the Series to a SeriesMIxed. The operation does not lock the Series.

Type returns the type of data the series holds.

func (s *SeriesGeneric) Unlock()

Unlock will unlock the Series that was previously locked.

func (s *SeriesGeneric) Update(row int, val interface{}, opts ...Options)

Update is used to update the value of a particular row. val can be a concrete data type or nil. Nil represents the absence of a value.

func (s *SeriesGeneric) Value(row int, opts ...Options) interface{}

Value returns the value of a particular row. The return value could be nil or the concrete type the data type held by the series. Pointers are never returned.

ValueString returns a string representation of a particular row. The string representation is defined by the function set in SetValueToStringFormatter. By default, a nil value is returned as "NaN".

func (s SeriesGeneric) ValuesIterator(opts ...ValuesOptions) func() (int, interface{}, int)

ValuesIterator will return a function that can be used to iterate through all the values.

type SeriesInit struct {

Size [int](/builtin#int)


Capacity [int](/builtin#int)

}

SeriesInit is used to configure the series when it is initialized

type SeriesInt64 struct {

}

SeriesInt64 is used for series containing int64 data.

func NewSeriesInt64(name string, init *SeriesInit, vals ...interface{}) *SeriesInt64

NewSeriesInt64 creates a new series with the underlying type as int64.

func (s *SeriesInt64) Append(val interface{}, opts ...Options) int

Append is used to set a value to the end of the series. val can be a concrete data type or nil. Nil represents the absence of a value.

func (s *SeriesInt64) ContainsNil(opts ...Options) bool

ContainsNil will return whether or not the series contains any nil values.

func (s *SeriesInt64) Copy(r ...Range) Series

Copy will create a new copy of the series. It is recommended that you lock the Series before attempting to Copy.

func (*SeriesInt64) FillRand

FillRand will fill a Series with random data. probNil is a value between between 0 and 1 which determines if a row is given a nil value.

func (s *SeriesInt64) Insert(row int, val interface{}, opts ...Options)

Insert is used to set a value at an arbitrary row in the series. All existing values from that row onwards are shifted by 1. val can be a concrete data type or nil. Nil represents the absence of a value.

IsEqual returns true if s2's values are equal to s.

func (s *SeriesInt64) IsEqualFunc(a, b interface{}) bool

IsEqualFunc returns true if a is equal to b.

func (s *SeriesInt64) IsLessThanFunc(a, b interface{}) bool

IsLessThanFunc returns true if a is less than b.

func (s *SeriesInt64) Lock()

Lock will lock the Series allowing you to directly manipulate the underlying slice with confidence.

Mean returns the mean. All non-nil values are ignored.

func (s *SeriesInt64) NRows(opts ...Options) int

NRows returns how many rows the series contains.

Name returns the series name.

NewSeries creates a new initialized SeriesInt64.

NilCount will return how many nil values are in the series.

func (s *SeriesInt64) Prepend(val interface{}, opts ...Options)

Prepend is used to set a value to the beginning of the series. val can be a concrete data type or nil. Nil represents the absence of a value.

func (s *SeriesInt64) Remove(row int, opts ...Options)

Remove is used to delete the value of a particular row.

Rename renames the series.

func (s *SeriesInt64) Reset(opts ...Options)

Reset is used clear all data contained in the Series.

func (s *SeriesInt64) SetValueToStringFormatter(f ValueToStringFormatter)

SetValueToStringFormatter is used to set a function to convert the value of a particular row to a string representation.

Sort will sort the series. It will return true if sorting was completed or false when the context is canceled.

String implements the fmt.Stringer interface. It does not lock the Series.

Sum returns the sum of all non-nil values. If all values are nil, a NaN is returned.

func (s *SeriesInt64) Swap(row1, row2 int, opts ...Options)

Swap is used to swap 2 values based on their row position.

Table will produce the Series in a table.

ToSeriesFloat64 will convert the Series to a SeriesFloat64. The operation does not lock the Series.

ToSeriesMixed will convert the Series to a SeriesMIxed. The operation does not lock the Series.

ToSeriesString will convert the Series to a SeriesString. The operation does not lock the Series.

Type returns the type of data the series holds.

func (s *SeriesInt64) Unlock()

Unlock will unlock the Series that was previously locked.

func (s *SeriesInt64) Update(row int, val interface{}, opts ...Options)

Update is used to update the value of a particular row. val can be a concrete data type or nil. Nil represents the absence of a value.

func (s *SeriesInt64) Value(row int, opts ...Options) interface{}

Value returns the value of a particular row. The return value could be nil or the concrete type the data type held by the series. Pointers are never returned.

ValueString returns a string representation of a particular row. The string representation is defined by the function set in SetValueToStringFormatter. By default, a nil value is returned as "NaN".

func (s SeriesInt64) ValuesIterator(opts ...ValuesOptions) func() (int, interface{}, int)

ValuesIterator will return a function that can be used to iterate through all the values.

type SeriesMixed struct {

}

SeriesMixed is used for series containing mixed data.

func NewSeriesMixed(name string, init *SeriesInit, vals ...interface{}) *SeriesMixed

NewSeriesMixed creates a new series with the underlying type as interface{}.

func (s *SeriesMixed) Append(val interface{}, opts ...Options) int

Append is used to set a value to the end of the series. val can be a concrete data type or nil. Nil represents the absence of a value.

func (s *SeriesMixed) ContainsNil(opts ...Options) bool

ContainsNil will return whether or not the series contains any nil values.

func (s *SeriesMixed) Copy(r ...Range) Series

Copy will create a new copy of the series. It is recommended that you lock the Series before attempting to Copy.

func (*SeriesMixed) FillRand

FillRand will fill a Series with random data. probNil is a value between between 0 and 1 which determines if a row is given a nil value.

func (s *SeriesMixed) Insert(row int, val interface{}, opts ...Options)

Insert is used to set a value at an arbitrary row in the series. All existing values from that row onwards are shifted by 1. val can be a concrete data type or nil. Nil represents the absence of a value.

IsEqual returns true if s2's values are equal to s.

func (s *SeriesMixed) IsEqualFunc(a, b interface{}) bool

IsEqualFunc returns true if a is equal to b.

func (s *SeriesMixed) IsLessThanFunc(a, b interface{}) bool

IsLessThanFunc returns true if a is less than b.

func (s *SeriesMixed) Lock()

Lock will lock the Series allowing you to directly manipulate the underlying slice with confidence.

func (s *SeriesMixed) NRows(opts ...Options) int

NRows returns how many rows the series contains.

Name returns the series name.

NewSeries creates a new initialized SeriesMixed.

NilCount will return how many nil values are in the series.

func (s *SeriesMixed) Prepend(val interface{}, opts ...Options)

Prepend is used to set a value to the beginning of the series. val can be a concrete data type or nil. Nil represents the absence of a value.

func (s *SeriesMixed) Remove(row int, opts ...Options)

Remove is used to delete the value of a particular row.

Rename renames the series.

func (s *SeriesMixed) Reset(opts ...Options)

Reset is used clear all data contained in the Series.

func (s *SeriesMixed) SetIsEqualFunc(f IsEqualFunc)

SetIsEqualFunc sets a function which can be used to determine if 2 values in the series are equal.

func (s *SeriesMixed) SetIsLessThanFunc(f IsLessThanFunc)

SetIsLessThanFunc sets a function which can be used to determine if a value is less than another in the series.

func (s *SeriesMixed) SetValueToStringFormatter(f ValueToStringFormatter)

SetValueToStringFormatter is used to set a function to convert the value of a particular row to a string representation.

Sort will sort the series. It will return true if sorting was completed or false when the context is canceled.

String implements the fmt.Stringer interface. It does not lock the Series.

func (s *SeriesMixed) Swap(row1, row2 int, opts ...Options)

Swap is used to swap 2 values based on their row position.

Table will produce the Series in a table.

ToSeriesString will convert the Series to a SeriesString. The operation does not lock the Series.

Type returns the type of data the series holds.

func (s *SeriesMixed) Unlock()

Unlock will unlock the Series that was previously locked.

func (s *SeriesMixed) Update(row int, val interface{}, opts ...Options)

Update is used to update the value of a particular row. val can be a concrete data type or nil. Nil represents the absence of a value.

func (s *SeriesMixed) Value(row int, opts ...Options) interface{}

Value returns the value of a particular row. The return value could be nil or the concrete type the data type held by the series. Pointers are never returned.

ValueString returns a string representation of a particular row. The string representation is defined by the function set in SetValueToStringFormatter. By default, a nil value is returned as "NaN".

func (s SeriesMixed) ValuesIterator(opts ...ValuesOptions) func() (int, interface{}, int)

ValuesIterator will return a function that can be used to iterate through all the values.

type SeriesReturnOpt uint8

SeriesReturnOpt is used to control if Row/Values method returns the series index, series name or both as map keys.

const (

SeriesIdx [SeriesReturnOpt](#SeriesReturnOpt) = 1 << [iota](/builtin#iota)

SeriesName

)

type SeriesString struct {

}

SeriesString is used for series containing string data.

func NewSeriesString(name string, init *SeriesInit, vals ...interface{}) *SeriesString

NewSeriesString creates a new series with the underlying type as string.

func (s *SeriesString) Append(val interface{}, opts ...Options) int

Append is used to set a value to the end of the series. val can be a concrete data type or nil. Nil represents the absence of a value.

func (s *SeriesString) ContainsNil(opts ...Options) bool

ContainsNil will return whether or not the series contains any nil values.

func (s *SeriesString) Copy(r ...Range) Series

Copy will create a new copy of the series. It is recommended that you lock the Series before attempting to Copy.

func (*SeriesString) FillRand

FillRand will fill a Series with random data. probNil is a value between between 0 and 1 which determines if a row is given a nil value.

func (s *SeriesString) Insert(row int, val interface{}, opts ...Options)

Insert is used to set a value at an arbitrary row in the series. All existing values from that row onwards are shifted by 1. val can be a concrete data type or nil. Nil represents the absence of a value.

IsEqual returns true if s2's values are equal to s.

func (s *SeriesString) IsEqualFunc(a, b interface{}) bool

IsEqualFunc returns true if a is equal to b.

func (s *SeriesString) IsLessThanFunc(a, b interface{}) bool

IsLessThanFunc returns true if a is less than b.

func (s *SeriesString) Lock()

Lock will lock the Series allowing you to directly manipulate the underlying slice with confidence.

func (s *SeriesString) NRows(opts ...Options) int

NRows returns how many rows the series contains.

Name returns the series name.

NewSeries creates a new initialized SeriesString.

NilCount will return how many nil values are in the series.

func (s *SeriesString) Prepend(val interface{}, opts ...Options)

Prepend is used to set a value to the beginning of the series. val can be a concrete data type or nil. Nil represents the absence of a value.

func (s *SeriesString) Remove(row int, opts ...Options)

Remove is used to delete the value of a particular row.

Rename renames the series.

func (s *SeriesString) Reset(opts ...Options)

Reset is used clear all data contained in the Series.

func (s *SeriesString) SetValueToStringFormatter(f ValueToStringFormatter)

SetValueToStringFormatter is used to set a function to convert the value of a particular row to a string representation.

Sort will sort the series. It will return true if sorting was completed or false when the context is canceled.

String implements the fmt.Stringer interface. It does not lock the Series.

func (s *SeriesString) Swap(row1, row2 int, opts ...Options)

Swap is used to swap 2 values based on their row position.

Table will produce the Series in a table.

ToSeriesFloat64 will convert the Series to a SeriesFloat64. The operation does not lock the Series.

ToSeriesInt64 will convert the Series to a SeriesInt64. The operation does not lock the Series.

ToSeriesMixed will convert the Series to a SeriesMIxed. The operation does not lock the Series.

Type returns the type of data the series holds.

func (s *SeriesString) Unlock()

Unlock will unlock the Series that was previously locked.

func (s *SeriesString) Update(row int, val interface{}, opts ...Options)

Update is used to update the value of a particular row. val can be a concrete data type or nil. Nil represents the absence of a value.

func (s *SeriesString) Value(row int, opts ...Options) interface{}

Value returns the value of a particular row. The return value could be nil or the concrete type the data type held by the series. Pointers are never returned.

ValueString returns a string representation of a particular row. The string representation is defined by the function set in SetValueToStringFormatter. By default, a nil value is returned as "NaN".

func (s SeriesString) ValuesIterator(opts ...ValuesOptions) func() (int, interface{}, int)

ValuesIterator will return a function that can be used to iterate through all the values.

SeriesTime is used for series containing time.Time data.

func NewSeriesTime(name string, init *SeriesInit, vals ...interface{}) *SeriesTime

NewSeriesTime creates a new series with the underlying type as time.Time.

func (s *SeriesTime) Append(val interface{}, opts ...Options) int

Append is used to set a value to the end of the series. val can be a concrete data type or nil. Nil represents the absence of a value.

func (s *SeriesTime) ContainsNil(opts ...Options) bool

ContainsNil will return whether or not the series contains any nil values.

func (s *SeriesTime) Copy(r ...Range) Series

Copy will create a new copy of the series. It is recommended that you lock the Series before attempting to Copy.

func (*SeriesTime) FillRand

FillRand will fill a Series with random data. probNil is a value between between 0 and 1 which determines if a row is given a nil value.

func (s *SeriesTime) Insert(row int, val interface{}, opts ...Options)

Insert is used to set a value at an arbitrary row in the series. All existing values from that row onwards are shifted by 1. val can be a concrete data type or nil. Nil represents the absence of a value.

IsEqual returns true if s2's values are equal to s.

func (s *SeriesTime) IsEqualFunc(a, b interface{}) bool

IsEqualFunc returns true if a is equal to b.

func (s *SeriesTime) IsLessThanFunc(a, b interface{}) bool

IsLessThanFunc returns true if a is less than b.

func (s *SeriesTime) Lock()

Lock will lock the Series allowing you to directly manipulate the underlying slice with confidence.

func (s *SeriesTime) NRows(opts ...Options) int

NRows returns how many rows the series contains.

Name returns the series name.

NewSeries creates a new initialized SeriesTime.

NilCount will return how many nil values are in the series.

func (s *SeriesTime) Prepend(val interface{}, opts ...Options)

Prepend is used to set a value to the beginning of the series. val can be a concrete data type or nil. Nil represents the absence of a value.

func (s *SeriesTime) Remove(row int, opts ...Options)

Remove is used to delete the value of a particular row.

Rename renames the series.

func (s *SeriesTime) Reset(opts ...Options)

Reset is used clear all data contained in the Series.

func (s *SeriesTime) SetValueToStringFormatter(f ValueToStringFormatter)

SetValueToStringFormatter is used to set a function to convert the value of a particular row to a string representation.

Sort will sort the series. It will return true if sorting was completed or false when the context is canceled.

String implements the fmt.Stringer interface. It does not lock the Series.

func (s *SeriesTime) Swap(row1, row2 int, opts ...Options)

Swap is used to swap 2 values based on their row position.

Table will produce the Series in a table.

ToSeriesFloat64 will convert the Series to a SeriesFloat64. The time format is Unix seconds. The operation does not lock the Series.

ToSeriesInt64 will convert the Series to a SeriesInt64. The time format is Unix seconds. The operation does not lock the Series.

ToSeriesMixed will convert the Series to a SeriesMIxed. The operation does not lock the Series.

Type returns the type of data the series holds.

func (s *SeriesTime) Unlock()

Unlock will unlock the Series that was previously locked.

func (s *SeriesTime) Update(row int, val interface{}, opts ...Options)

Update is used to update the value of a particular row. val can be a concrete data type or nil. Nil represents the absence of a value.

func (s *SeriesTime) Value(row int, opts ...Options) interface{}

Value returns the value of a particular row. The return value could be nil or the concrete type the data type held by the series. Pointers are never returned.

ValueString returns a string representation of a particular row. The string representation is defined by the function set in SetValueToStringFormatter. By default, a nil value is returned as "NaN".

func (s SeriesTime) ValuesIterator(opts ...ValuesOptions) func() (int, interface{}, int)

ValuesIterator will return a function that can be used to iterate through all the values.

type SortKey struct {

Key interface{}


Desc [bool](/builtin#bool)

}

SortKey is the key to sort a Dataframe

type SortOptions struct {

Stable [bool](/builtin#bool)


Desc [bool](/builtin#bool)


DontLock [bool](/builtin#bool)

}

SortOptions is used to configure the sort algorithm for a Dataframe or Series

type TableOptions struct {

Series []interface{}


R *[Range](#Range)


DontLock [bool](/builtin#bool)

}

TableOptions can be used to limit the number of rows and which Series are used when generating the table.

ToSeriesFloat64 is an interface used by the Dataframe to know if a particular Series can be converted to a SeriesFloat64 Series.

ToSeriesInt64 is an interface used by the Dataframe to know if a particular Series can be converted to a SeriesInt64 Series.

ToSeriesMixed is an interface used by the Dataframe to know if a particular Series can be converted to a ToSeriesMixed Series.

ToSeriesString is an interface used by the Dataframe to know if a particular Series can be converted to a SeriesString Series.

type ValueToStringFormatter func(val interface{}) string

ValueToStringFormatter is used to convert a value into a string. Val can be nil or the concrete type stored by the series.

type ValuesOptions struct {

InitialRow [int](/builtin#int)


Step [int](/builtin#int)


DontReadLock [bool](/builtin#bool)

}

ValuesOptions is used to modify the behavior of Values().