Documentation ¶
Index ¶
- Constants
- Variables
- func Apply(ctx context.Context, sdf interface{}, fn interface{}, opts ...FilterOptions) (interface{}, error)
- func B(b bool) int
- func BoolValueFormatter(v interface{}) string
- func DefaultIsEqualFunc(a, b interface{}) bool
- func DefaultValueFormatter(v interface{}) string
- func Filter(ctx context.Context, sdf interface{}, fn interface{}, opts ...FilterOptions) (interface{}, error)
- func IsValidFloat64(f float64) bool
- type ApplyDataFrameFn
- type ApplySeriesFn
- type AsciiGraphOptions
- type DataFrame
- func (df *DataFrame) AddSeries(s Series, colN *int, opts ...Options) error
- func (df *DataFrame) Append(opts *Options, vals ...interface{})
- func (df *DataFrame) ClearRow(row int, opts ...Options)
- func (df *DataFrame) Copy(r ...Range) *DataFrame
- func (df *DataFrame) FillRand(src rand.Source, probNil float64, rander Rander, opts ...FillRandOptions)
- func (df *DataFrame) Insert(row int, opts *Options, vals ...interface{})
- func (df *DataFrame) IsEqual(ctx context.Context, df2 *DataFrame, opts ...IsEqualOptions) (bool, error)
- func (df *DataFrame) Lock(deepLock ...bool)
- func (df *DataFrame) MustNameToColumn(seriesName string, opts ...Options) int
- func (df *DataFrame) NRows(opts ...Options) int
- func (df *DataFrame) NameToColumn(seriesName string, opts ...Options) (int, error)
- func (df *DataFrame) Names(opts ...Options) []string
- func (df *DataFrame) Prepend(opts *Options, vals ...interface{})
- func (df *DataFrame) Remove(row int, opts ...Options)
- func (df *DataFrame) RemoveSeries(seriesName string, opts ...Options) error
- func (df *DataFrame) ReorderColumns(newOrder []string, opts ...Options) error
- func (df *DataFrame) Row(row int, dontReadLock bool, retOpt ...SeriesReturnOpt) map[interface{}]interface{}
- func (df *DataFrame) Sort(ctx context.Context, keys []SortKey, opts ...SortOptions) (completed bool)
- func (df *DataFrame) String() string
- func (df *DataFrame) Swap(row1, row2 int, opts ...Options)
- func (df *DataFrame) Table(opts ...TableOptions) string
- func (df *DataFrame) Unlock(deepUnlock ...bool)
- func (df *DataFrame) Update(row int, col interface{}, val interface{}, opts ...Options)
- func (df *DataFrame) UpdateRow(row int, opts *Options, vals ...interface{})
- func (df *DataFrame) ValuesIterator(opts ...ValuesOptions) func(opts ...SeriesReturnOpt) (*int, map[interface{}]interface{}, int)
- type ErrorCollection
- type FillRandOptions
- type FillRander
- type FilterAction
- type FilterDataFrameFn
- type FilterOptions
- type FilterSeriesFn
- type IsEqualFunc
- type IsEqualOptions
- type IsLessThanFunc
- type NewSerieser
- type NilCountOptions
- type Options
- type OrderedMapIntFloat64
- type OrderedMapIntMixed
- type Rander
- type Range
- type RowError
- type Series
- type SeriesFloat64
- func (s *SeriesFloat64) Append(val interface{}, opts ...Options) int
- func (s *SeriesFloat64) AsciiGraph(opts ...AsciiGraphOptions) string
- func (s *SeriesFloat64) ContainsNil(opts ...Options) bool
- func (s *SeriesFloat64) Copy(r ...Range) Series
- func (s *SeriesFloat64) FillRand(src rand.Source, probNil float64, rander Rander, opts ...FillRandOptions)
- func (s *SeriesFloat64) Insert(row int, val interface{}, opts ...Options)
- func (s *SeriesFloat64) IsEqual(ctx context.Context, s2 Series, opts ...IsEqualOptions) (bool, error)
- func (s *SeriesFloat64) IsEqualFunc(a, b interface{}) bool
- func (s *SeriesFloat64) IsLessThanFunc(a, b interface{}) bool
- func (s *SeriesFloat64) Lock()
- func (s *SeriesFloat64) Mean(ctx context.Context) (float64, error)
- func (s *SeriesFloat64) NRows(opts ...Options) int
- func (s *SeriesFloat64) Name(opts ...Options) string
- func (s *SeriesFloat64) NewSeries(name string, init *SeriesInit) Series
- func (s *SeriesFloat64) NilCount(opts ...NilCountOptions) (int, error)
- func (s *SeriesFloat64) Prepend(val interface{}, opts ...Options)
- func (s *SeriesFloat64) Remove(row int, opts ...Options)
- func (s *SeriesFloat64) Rename(n string, opts ...Options)
- func (s *SeriesFloat64) Reset(opts ...Options)
- func (s *SeriesFloat64) SetValueToStringFormatter(f ValueToStringFormatter)
- func (s *SeriesFloat64) Sort(ctx context.Context, opts ...SortOptions) (completed bool)
- func (s *SeriesFloat64) String() string
- func (s *SeriesFloat64) Sum(ctx context.Context) (float64, error)
- func (s *SeriesFloat64) Swap(row1, row2 int, opts ...Options)
- func (s *SeriesFloat64) Table(opts ...TableOptions) string
- func (s *SeriesFloat64) ToSeriesFloat64(ctx context.Context, removeNil bool, ...) (*SeriesFloat64, error)
- func (s *SeriesFloat64) ToSeriesMixed(ctx context.Context, removeNil bool, ...) (*SeriesMixed, error)
- func (s *SeriesFloat64) ToSeriesString(ctx context.Context, removeNil bool, ...) (*SeriesString, error)
- func (s *SeriesFloat64) Type() string
- func (s *SeriesFloat64) Unlock()
- func (s *SeriesFloat64) Update(row int, val interface{}, opts ...Options)
- func (s *SeriesFloat64) Value(row int, opts ...Options) interface{}
- func (s *SeriesFloat64) ValueString(row int, opts ...Options) string
- func (s *SeriesFloat64) ValuesIterator(opts ...ValuesOptions) func() (*int, interface{}, int)
- type SeriesGeneric
- func (s *SeriesGeneric) Append(val interface{}, opts ...Options) int
- func (s *SeriesGeneric) ContainsNil(opts ...Options) bool
- func (s *SeriesGeneric) Copy(r ...Range) Series
- func (s *SeriesGeneric) Insert(row int, val interface{}, opts ...Options)
- func (s *SeriesGeneric) IsEqual(ctx context.Context, s2 Series, opts ...IsEqualOptions) (bool, error)
- func (s *SeriesGeneric) IsEqualFunc(a, b interface{}) bool
- func (s *SeriesGeneric) IsLessThanFunc(a, b interface{}) bool
- func (s *SeriesGeneric) Lock()
- func (s *SeriesGeneric) NRows(opts ...Options) int
- func (s *SeriesGeneric) Name(opts ...Options) string
- func (s *SeriesGeneric) NilCount(opts ...NilCountOptions) (int, error)
- func (s *SeriesGeneric) Prepend(val interface{}, opts ...Options)
- func (s *SeriesGeneric) Remove(row int, opts ...Options)
- func (s *SeriesGeneric) Rename(n string, opts ...Options)
- func (s *SeriesGeneric) Reset(opts ...Options)
- func (s *SeriesGeneric) SetIsEqualFunc(f IsEqualFunc)
- func (s *SeriesGeneric) SetIsLessThanFunc(f IsLessThanFunc)
- func (s *SeriesGeneric) SetValueToStringFormatter(f ValueToStringFormatter)
- func (s *SeriesGeneric) Sort(ctx context.Context, opts ...SortOptions) (completed bool)
- func (s *SeriesGeneric) String() string
- func (s *SeriesGeneric) Swap(row1, row2 int, opts ...Options)
- func (s *SeriesGeneric) Table(opts ...TableOptions) string
- func (s *SeriesGeneric) ToSeriesMixed(ctx context.Context, removeNil bool, ...) (*SeriesMixed, error)
- func (s *SeriesGeneric) Type() string
- func (s *SeriesGeneric) Unlock()
- func (s *SeriesGeneric) Update(row int, val interface{}, opts ...Options)
- func (s *SeriesGeneric) Value(row int, opts ...Options) interface{}
- func (s *SeriesGeneric) ValueString(row int, opts ...Options) string
- func (s *SeriesGeneric) ValuesIterator(opts ...ValuesOptions) func() (*int, interface{}, int)
- type SeriesInit
- type SeriesInt64
- func (s *SeriesInt64) Append(val interface{}, opts ...Options) int
- func (s *SeriesInt64) ContainsNil(opts ...Options) bool
- func (s *SeriesInt64) Copy(r ...Range) Series
- func (s *SeriesInt64) FillRand(src rand.Source, probNil float64, rander Rander, opts ...FillRandOptions)
- func (s *SeriesInt64) Insert(row int, val interface{}, opts ...Options)
- func (s *SeriesInt64) IsEqual(ctx context.Context, s2 Series, opts ...IsEqualOptions) (bool, error)
- func (s *SeriesInt64) IsEqualFunc(a, b interface{}) bool
- func (s *SeriesInt64) IsLessThanFunc(a, b interface{}) bool
- func (s *SeriesInt64) Lock()
- func (s *SeriesInt64) Mean(ctx context.Context) (float64, error)
- func (s *SeriesInt64) NRows(opts ...Options) int
- func (s *SeriesInt64) Name(opts ...Options) string
- func (s *SeriesInt64) NewSeries(name string, init *SeriesInit) Series
- func (s *SeriesInt64) NilCount(opts ...NilCountOptions) (int, error)
- func (s *SeriesInt64) Prepend(val interface{}, opts ...Options)
- func (s *SeriesInt64) Remove(row int, opts ...Options)
- func (s *SeriesInt64) Rename(n string, opts ...Options)
- func (s *SeriesInt64) Reset(opts ...Options)
- func (s *SeriesInt64) SetValueToStringFormatter(f ValueToStringFormatter)
- func (s *SeriesInt64) Sort(ctx context.Context, opts ...SortOptions) (completed bool)
- func (s *SeriesInt64) String() string
- func (s *SeriesInt64) Sum(ctx context.Context) (float64, error)
- func (s *SeriesInt64) Swap(row1, row2 int, opts ...Options)
- func (s *SeriesInt64) Table(opts ...TableOptions) string
- func (s *SeriesInt64) ToSeriesFloat64(ctx context.Context, removeNil bool, ...) (*SeriesFloat64, error)
- func (s *SeriesInt64) ToSeriesMixed(ctx context.Context, removeNil bool, ...) (*SeriesMixed, error)
- func (s *SeriesInt64) ToSeriesString(ctx context.Context, removeNil bool, ...) (*SeriesString, error)
- func (s *SeriesInt64) Type() string
- func (s *SeriesInt64) Unlock()
- func (s *SeriesInt64) Update(row int, val interface{}, opts ...Options)
- func (s *SeriesInt64) Value(row int, opts ...Options) interface{}
- func (s *SeriesInt64) ValueString(row int, opts ...Options) string
- func (s *SeriesInt64) ValuesIterator(opts ...ValuesOptions) func() (*int, interface{}, int)
- type SeriesMixed
- func (s *SeriesMixed) Append(val interface{}, opts ...Options) int
- func (s *SeriesMixed) ContainsNil(opts ...Options) bool
- func (s *SeriesMixed) Copy(r ...Range) Series
- func (s *SeriesMixed) FillRand(src rand.Source, probNil float64, rander Rander, opts ...FillRandOptions)
- func (s *SeriesMixed) Insert(row int, val interface{}, opts ...Options)
- func (s *SeriesMixed) IsEqual(ctx context.Context, s2 Series, opts ...IsEqualOptions) (bool, error)
- func (s *SeriesMixed) IsEqualFunc(a, b interface{}) bool
- func (s *SeriesMixed) IsLessThanFunc(a, b interface{}) bool
- func (s *SeriesMixed) Lock()
- func (s *SeriesMixed) NRows(opts ...Options) int
- func (s *SeriesMixed) Name(opts ...Options) string
- func (s *SeriesMixed) NewSeries(name string, init *SeriesInit) Series
- func (s *SeriesMixed) NilCount(opts ...NilCountOptions) (int, error)
- func (s *SeriesMixed) Prepend(val interface{}, opts ...Options)
- func (s *SeriesMixed) Remove(row int, opts ...Options)
- func (s *SeriesMixed) Rename(n string, opts ...Options)
- func (s *SeriesMixed) Reset(opts ...Options)
- func (s *SeriesMixed) SetIsEqualFunc(f IsEqualFunc)
- func (s *SeriesMixed) SetIsLessThanFunc(f IsLessThanFunc)
- func (s *SeriesMixed) SetValueToStringFormatter(f ValueToStringFormatter)
- func (s *SeriesMixed) Sort(ctx context.Context, opts ...SortOptions) (completed bool)
- func (s *SeriesMixed) String() string
- func (s *SeriesMixed) Swap(row1, row2 int, opts ...Options)
- func (s *SeriesMixed) Table(opts ...TableOptions) string
- func (s *SeriesMixed) ToSeriesString(ctx context.Context, removeNil bool, ...) (*SeriesString, error)
- func (s *SeriesMixed) Type() string
- func (s *SeriesMixed) Unlock()
- func (s *SeriesMixed) Update(row int, val interface{}, opts ...Options)
- func (s *SeriesMixed) Value(row int, opts ...Options) interface{}
- func (s *SeriesMixed) ValueString(row int, opts ...Options) string
- func (s *SeriesMixed) ValuesIterator(opts ...ValuesOptions) func() (*int, interface{}, int)
- type SeriesReturnOpt
- type SeriesString
- func (s *SeriesString) Append(val interface{}, opts ...Options) int
- func (s *SeriesString) ContainsNil(opts ...Options) bool
- func (s *SeriesString) Copy(r ...Range) Series
- func (s *SeriesString) FillRand(src rand.Source, probNil float64, rander Rander, opts ...FillRandOptions)
- func (s *SeriesString) Insert(row int, val interface{}, opts ...Options)
- func (s *SeriesString) IsEqual(ctx context.Context, s2 Series, opts ...IsEqualOptions) (bool, error)
- func (s *SeriesString) IsEqualFunc(a, b interface{}) bool
- func (s *SeriesString) IsLessThanFunc(a, b interface{}) bool
- func (s *SeriesString) Lock()
- func (s *SeriesString) NRows(opts ...Options) int
- func (s *SeriesString) Name(opts ...Options) string
- func (s *SeriesString) NewSeries(name string, init *SeriesInit) Series
- func (s *SeriesString) NilCount(opts ...NilCountOptions) (int, error)
- func (s *SeriesString) Prepend(val interface{}, opts ...Options)
- func (s *SeriesString) Remove(row int, opts ...Options)
- func (s *SeriesString) Rename(n string, opts ...Options)
- func (s *SeriesString) Reset(opts ...Options)
- func (s *SeriesString) SetValueToStringFormatter(f ValueToStringFormatter)
- func (s *SeriesString) Sort(ctx context.Context, opts ...SortOptions) (completed bool)
- func (s *SeriesString) String() string
- func (s *SeriesString) Swap(row1, row2 int, opts ...Options)
- func (s *SeriesString) Table(opts ...TableOptions) string
- func (s *SeriesString) ToSeriesFloat64(ctx context.Context, removeNil bool, ...) (*SeriesFloat64, error)
- func (s *SeriesString) ToSeriesInt64(ctx context.Context, removeNil bool, conv ...func(interface{}) (*int64, error)) (*SeriesInt64, error)
- func (s *SeriesString) ToSeriesMixed(ctx context.Context, removeNil bool, ...) (*SeriesMixed, error)
- func (s *SeriesString) Type() string
- func (s *SeriesString) Unlock()
- func (s *SeriesString) Update(row int, val interface{}, opts ...Options)
- func (s *SeriesString) Value(row int, opts ...Options) interface{}
- func (s *SeriesString) ValueString(row int, opts ...Options) string
- func (s *SeriesString) ValuesIterator(opts ...ValuesOptions) func() (*int, interface{}, int)
- type SeriesTime
- func (s *SeriesTime) Append(val interface{}, opts ...Options) int
- func (s *SeriesTime) ContainsNil(opts ...Options) bool
- func (s *SeriesTime) Copy(r ...Range) Series
- func (s *SeriesTime) FillRand(src rand.Source, probNil float64, rander Rander, opts ...FillRandOptions)
- func (s *SeriesTime) Insert(row int, val interface{}, opts ...Options)
- func (s *SeriesTime) IsEqual(ctx context.Context, s2 Series, opts ...IsEqualOptions) (bool, error)
- func (s *SeriesTime) IsEqualFunc(a, b interface{}) bool
- func (s *SeriesTime) IsLessThanFunc(a, b interface{}) bool
- func (s *SeriesTime) Lock()
- func (s *SeriesTime) NRows(opts ...Options) int
- func (s *SeriesTime) Name(opts ...Options) string
- func (s *SeriesTime) NewSeries(name string, init *SeriesInit) Series
- func (s *SeriesTime) NilCount(opts ...NilCountOptions) (int, error)
- func (s *SeriesTime) Prepend(val interface{}, opts ...Options)
- func (s *SeriesTime) Remove(row int, opts ...Options)
- func (s *SeriesTime) Rename(n string, opts ...Options)
- func (s *SeriesTime) Reset(opts ...Options)
- func (s *SeriesTime) SetValueToStringFormatter(f ValueToStringFormatter)
- func (s *SeriesTime) Sort(ctx context.Context, opts ...SortOptions) (completed bool)
- func (s *SeriesTime) String() string
- func (s *SeriesTime) Swap(row1, row2 int, opts ...Options)
- func (s *SeriesTime) Table(opts ...TableOptions) string
- func (s *SeriesTime) ToSeriesFloat64(ctx context.Context, removeNil bool, ...) (*SeriesFloat64, error)
- func (s *SeriesTime) ToSeriesInt64(ctx context.Context, removeNil bool, conv ...func(interface{}) (*int64, error)) (*SeriesInt64, error)
- func (s *SeriesTime) ToSeriesMixed(ctx context.Context, removeNil bool, ...) (*SeriesMixed, error)
- func (s *SeriesTime) Type() string
- func (s *SeriesTime) Unlock()
- func (s *SeriesTime) Update(row int, val interface{}, opts ...Options)
- func (s *SeriesTime) Value(row int, opts ...Options) interface{}
- func (s *SeriesTime) ValueString(row int, opts ...Options) string
- func (s *SeriesTime) ValuesIterator(opts ...ValuesOptions) func() (*int, interface{}, int)
- type SortKey
- type SortOptions
- type TableOptions
- type ToSeriesFloat64
- type ToSeriesInt64
- type ToSeriesMixed
- type ToSeriesString
- type ValueToStringFormatter
- type ValuesOptions
Constants ¶
const ( // FALSE is used convert a false (bool) to an int. FALSE = 0 // TRUE is used convert a true (bool) to an int. TRUE = 1 )
Variables ¶
var DontLock = dontLock
DontLock is short-hand for various functions that permit disabling locking.
var ErrNoRows = errors.New("contains no rows")
ErrNoRows signifies that the Series, Dataframe or import data contains no rows of data.
Functions ¶
func Apply ¶
func Apply(ctx context.Context, sdf interface{}, fn interface{}, opts ...FilterOptions) (interface{}, error)
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.
func BoolValueFormatter ¶
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 ¶
func DefaultIsEqualFunc(a, b interface{}) bool
DefaultIsEqualFunc is the default comparitor to determine if two values in the series are the same.
func DefaultValueFormatter ¶
func DefaultValueFormatter(v interface{}) string
DefaultValueFormatter will return a string representation of the data in a particular row.
func Filter ¶
func Filter(ctx context.Context, sdf interface{}, fn interface{}, opts ...FilterOptions) (interface{}, error)
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.
func IsValidFloat64 ¶
IsValidFloat64 returns true if f is neither Nan nor ±Inf. Otherwise it returns false.
Types ¶
type ApplyDataFrameFn ¶
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 ¶
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 ¶
type AsciiGraphOptions struct { // Caption sets the graph's caption. Caption string // Height sets the graph's height. Height int // Offset sets the graph's offset. Offset int // Width sets the graph's width. By default, the width of the graph is determined by the number of data points. // If the value given is a positive number, the data points are interpolated on the x axis. Values <= 0 reset the width to the default value. Width int // R is used to limit the range of rows. R *Range }
AsciiGraphOptions can be used to configure the look of the graph.
type DataFrame ¶
type DataFrame struct { Series []Series // contains filtered or unexported fields }
DataFrame allows you to handle numerous series of data conveniently.
func NewDataFrame ¶
NewDataFrame creates a new dataframe.
func (*DataFrame) AddSeries ¶
AddSeries will add a Series to the end of the DataFrame, unless set by ColN.
func (*DataFrame) Copy ¶
Copy will create a new copy of the Dataframe. It is recommended that you lock the Dataframe before attempting to Copy.
func (*DataFrame) FillRand ¶
func (df *DataFrame) FillRand(src rand.Source, probNil float64, rander Rander, opts ...FillRandOptions)
FillRand will randomly fill all the Series in the Dataframe.
func (*DataFrame) IsEqual ¶
func (df *DataFrame) IsEqual(ctx context.Context, df2 *DataFrame, opts ...IsEqualOptions) (bool, error)
IsEqual returns true if df2's values are equal to df.
func (*DataFrame) Lock ¶
Lock will lock the Dataframe allowing you to directly manipulate the underlying Series with confidence.
func (*DataFrame) MustNameToColumn ¶
MustNameToColumn returns the index of the series based on the name. The starting index is 0. If seriesName doesn't exist it panics.
func (*DataFrame) NRows ¶
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.
func (*DataFrame) RemoveSeries ¶
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 (*DataFrame) Row ¶
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)
func (*DataFrame) Sort ¶
func (df *DataFrame) Sort(ctx context.Context, keys []SortKey, opts ...SortOptions) (completed bool)
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.
func (*DataFrame) String ¶
String implements the fmt.Stringer interface. It does not lock the DataFrame.
func (*DataFrame) Table ¶
func (df *DataFrame) Table(opts ...TableOptions) string
Table will produce the DataFrame in a table.
func (*DataFrame) Update ¶
Update is used to update a specific entry. col can be the name of the series or the column number.
func (*DataFrame) ValuesIterator ¶
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()
type ErrorCollection ¶
ErrorCollection is used to hold multiple errors.
func NewErrorCollection ¶
func NewErrorCollection() *ErrorCollection
NewErrorCollection returns a new ErrorCollection. ErrorCollection is compatible with errors.Is and errors.As functions.
func (*ErrorCollection) AddError ¶
func (ec *ErrorCollection) AddError(err error, lock ...bool)
AddError inserts a new error to the ErrorCollection. If err is nil, the function will panic.
func (*ErrorCollection) As ¶
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.
func (*ErrorCollection) Error ¶
func (ec *ErrorCollection) Error() string
Error implements the error interface.
func (*ErrorCollection) Is ¶
func (ec *ErrorCollection) Is(err error) bool
Is returns true if ErrorCollection contains err.
func (*ErrorCollection) IsNil ¶
func (ec *ErrorCollection) IsNil(lock ...bool) bool
IsNil returns whether the ErrorCollection contains any errors.
type FillRandOptions ¶
type FillRandOptions struct { // R is used to only randomly fill a range of rows. R *Range // Extra is used to pass extra custom data. Extra interface{} }
FillRandOptions configures how FillRand should behave.
type FillRander ¶
type FillRander interface { // 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. // // Example: // // import "golang.org/x/exp/rand" // import "gonum.org/v1/gonum/stat/distuv" // import "time" // // src := rand.NewSource(uint64(time.Now().UTC().UnixNano())) // uniform := distuv.Uniform{Min: 0, Max: 10000, Src: src} // s.FillRand(src, 0.5, uniform) // FillRand(src rand.Source, probNil float64, rander Rander, opts ...FillRandOptions) }
FillRander is an interface for generating a Series with random values.
type FilterAction ¶
type FilterAction int
FilterAction is the return value of FilterSeriesFn and FilterDataFrameFn.
const ( // DROP is used to signify that a row must be dropped. DROP FilterAction = 0 // KEEP is used to signify that a row must be kept. KEEP FilterAction = 1 // CHOOSE is used to signify that a row must be kept. CHOOSE FilterAction = 1 )
type FilterDataFrameFn ¶
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 ¶
type FilterOptions struct { // InPlace will perform the filter operation on the current Series or DataFrame. // If InPlace is not set, a new Series or DataFrame will be returned with rows based // on the filter operation. The original Series or DataFrame will be unmodified. InPlace bool // DontLock can be set to true if the Series should not be locked. DontLock bool }
FilterOptions modifies the behavior of the Filter function.
type FilterSeriesFn ¶
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 ¶
type IsEqualFunc func(a, b interface{}) bool
IsEqualFunc is used to determine if a and b are considered equal.
type IsEqualOptions ¶
type IsEqualOptions struct { // Don't apply lock. DontLock bool // Check if name is the same. CheckName bool }
IsEqualOptions sets various options for the IsEqual function.
type IsLessThanFunc ¶
type IsLessThanFunc func(a, b interface{}) bool
IsLessThanFunc returns true if a < b
type NewSerieser ¶
type NewSerieser interface { // NewSeries creates a new initialized Series of the same type. NewSeries(name string, init *SeriesInit) Series }
NewSerieser is an interface for a Series to create a new initialized Series of the same type.
type NilCountOptions ¶
type NilCountOptions struct { // Ctx adds a context. Ctx context.Context // R is used to limit the range. R *Range // Don't apply lock. DontLock bool // When StopAtOneNil is set, the function will return after finding at least 1 nil value. // It can be used as a ContainsNil function when used with R. StopAtOneNil bool }
NilCountOptions sets various options for the NilCount function.
type Options ¶
type Options struct { // Don't apply lock. DontLock bool }
Options sets various options.
type OrderedMapIntFloat64 ¶
type OrderedMapIntFloat64 struct {
// contains filtered or unexported fields
}
OrderedMapIntFloat64 is an ordered map[int]float64.
func NewOrderedMapIntFloat64 ¶
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 (*OrderedMapIntFloat64) Delete ¶
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.
func (*OrderedMapIntFloat64) Get ¶
func (o *OrderedMapIntFloat64) Get(key int) (float64, bool)
Get will return the value of the key. If it doesn't exist, it will return false for the second return value.
func (*OrderedMapIntFloat64) Set ¶
func (o *OrderedMapIntFloat64) Set(key int, val float64)
Set will set a key and value pair. It will overwrite an existing pair if it exists already.
func (*OrderedMapIntFloat64) ValuesIterator ¶
func (o *OrderedMapIntFloat64) ValuesIterator() func() (*int, float64)
ValuesIterator is used to iterate through the values of OrderedMapIntFloat64.
type OrderedMapIntMixed ¶
type OrderedMapIntMixed struct {
// contains filtered or unexported fields
}
OrderedMapIntMixed is an ordered map[int]interface{}.
func NewOrderedMapIntMixed ¶
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 (*OrderedMapIntMixed) Delete ¶
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.
func (*OrderedMapIntMixed) Get ¶
func (o *OrderedMapIntMixed) Get(key int) (interface{}, bool)
Get will return the value of the key. If it doesn't exist, it will return false for the second return value.
func (*OrderedMapIntMixed) Set ¶
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 (*OrderedMapIntMixed) ValuesIterator ¶
func (o *OrderedMapIntMixed) ValuesIterator() func() (*int, interface{})
ValuesIterator is used to iterate through the values of OrderedMapIntMixed.
type Rander ¶
type Rander interface { // Rand returns a randomly generated float64. Rand() float64 }
Rander is an interface for generating random float64.
See: https://godoc.org/golang.org/x/exp/rand for a random generator source. See: https://godoc.org/gonum.org/v1/gonum/stat/distuv for various random distributions.
type Range ¶
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 ¶
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 ¶
RangeFinite returns a Range that has a finite span.
func (*Range) Limits ¶
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.
type Series ¶
type Series interface { // Name returns the series name. Name(opts ...Options) string // Rename renames the series. Rename(n string, opts ...Options) // Type returns the type of data the series holds. Type() string // NRows returns how many rows the series contains. NRows(opts ...Options) int // 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. Value(row int, opts ...Options) interface{} // 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". ValueString(row int, opts ...Options) string // 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. Prepend(val interface{}, opts ...Options) // 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. Append(val interface{}, opts ...Options) int // 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. Insert(row int, val interface{}, opts ...Options) // Remove is used to delete the value of a particular row. Remove(row int, opts ...Options) // Reset is used clear all data contained in the Series. Reset(opts ...Options) // ValuesIterator will return a function that can be used to iterate through all the values. ValuesIterator(opts ...ValuesOptions) func() (*int, interface{}, int) // 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. Update(row int, val interface{}, opts ...Options) // SetValueToStringFormatter is used to set a function // to convert the value of a particular row to a string // representation. SetValueToStringFormatter(f ValueToStringFormatter) // Sort will sort the series. // It will return true if sorting was completed or false when the context is canceled. Sort(ctx context.Context, opts ...SortOptions) (completed bool) // IsEqualFunc returns true if a is equal to b. IsEqualFunc(a, b interface{}) bool // IsLessThanFunc returns true if a is less than b. IsLessThanFunc(a, b interface{}) bool // Swap is used to swap 2 values based on their row position. Swap(row1, row2 int, opts ...Options) // Lock will lock the Series allowing you to directly manipulate // the underlying slice with confidence. Lock() // Unlock will unlock the Series that was previously locked. Unlock() // Copy will create a new copy of the series. // It is recommended that you lock the Series before attempting // to Copy. Copy(r ...Range) Series // ContainsNil will return whether or not the series contains any nil values. ContainsNil(opts ...Options) bool // NilCount will return how many nil values are in the series. NilCount(opts ...NilCountOptions) (int, error) // IsEqual returns true if s2's values are equal to s. IsEqual(ctx context.Context, s2 Series, opts ...IsEqualOptions) (bool, error) }
Series is a collection of data that could be of any type. It is usually used with DataFrame.
type SeriesFloat64 ¶
type SeriesFloat64 struct { // Values is exported to better improve interoperability with the gonum package. // // See: https://godoc.org/gonum.org/v1/gonum // // WARNING: Do not modify directly. Values []float64 // contains filtered or unexported fields }
SeriesFloat64 is used for series containing float64 data.
func NewSeriesFloat64 ¶
func NewSeriesFloat64(name string, init *SeriesInit, vals ...interface{}) *SeriesFloat64
NewSeriesFloat64 creates a new series with the underlying type as float64.
func (*SeriesFloat64) Append ¶
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.
func (*SeriesFloat64) AsciiGraph ¶
func (s *SeriesFloat64) AsciiGraph(opts ...AsciiGraphOptions) string
AsciiGraph will produce a simple ascii based graph of the data. The function will panic if the range R is invalid.
func (*SeriesFloat64) ContainsNil ¶
func (s *SeriesFloat64) ContainsNil(opts ...Options) bool
ContainsNil will return whether or not the series contains any nil values.
func (*SeriesFloat64) Copy ¶
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 ¶
func (s *SeriesFloat64) FillRand(src rand.Source, probNil float64, rander Rander, opts ...FillRandOptions)
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 (*SeriesFloat64) Insert ¶
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.
func (*SeriesFloat64) IsEqual ¶
func (s *SeriesFloat64) IsEqual(ctx context.Context, s2 Series, opts ...IsEqualOptions) (bool, error)
IsEqual returns true if s2's values are equal to s.
func (*SeriesFloat64) IsEqualFunc ¶
func (s *SeriesFloat64) IsEqualFunc(a, b interface{}) bool
IsEqualFunc returns true if a is equal to b.
func (*SeriesFloat64) IsLessThanFunc ¶
func (s *SeriesFloat64) IsLessThanFunc(a, b interface{}) bool
IsLessThanFunc returns true if a is less than b.
func (*SeriesFloat64) Lock ¶
func (s *SeriesFloat64) Lock()
Lock will lock the Series allowing you to directly manipulate the underlying slice with confidence.
func (*SeriesFloat64) Mean ¶
func (s *SeriesFloat64) Mean(ctx context.Context) (float64, error)
Mean returns the mean. All non-nil values are ignored.
func (*SeriesFloat64) NRows ¶
func (s *SeriesFloat64) NRows(opts ...Options) int
NRows returns how many rows the series contains.
func (*SeriesFloat64) Name ¶
func (s *SeriesFloat64) Name(opts ...Options) string
Name returns the series name.
func (*SeriesFloat64) NewSeries ¶
func (s *SeriesFloat64) NewSeries(name string, init *SeriesInit) Series
NewSeries creates a new initialized SeriesFloat64.
func (*SeriesFloat64) NilCount ¶
func (s *SeriesFloat64) NilCount(opts ...NilCountOptions) (int, error)
NilCount will return how many nil values are in the series.
func (*SeriesFloat64) Prepend ¶
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 (*SeriesFloat64) Remove ¶
func (s *SeriesFloat64) Remove(row int, opts ...Options)
Remove is used to delete the value of a particular row.
func (*SeriesFloat64) Rename ¶
func (s *SeriesFloat64) Rename(n string, opts ...Options)
Rename renames the series.
func (*SeriesFloat64) Reset ¶
func (s *SeriesFloat64) Reset(opts ...Options)
Reset is used clear all data contained in the Series.
func (*SeriesFloat64) SetValueToStringFormatter ¶
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.
func (*SeriesFloat64) Sort ¶
func (s *SeriesFloat64) Sort(ctx context.Context, opts ...SortOptions) (completed bool)
Sort will sort the series. It will return true if sorting was completed or false when the context is canceled.
func (*SeriesFloat64) String ¶
func (s *SeriesFloat64) String() string
String implements the fmt.Stringer interface. It does not lock the Series.
func (*SeriesFloat64) Sum ¶
func (s *SeriesFloat64) Sum(ctx context.Context) (float64, error)
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 (*SeriesFloat64) Swap ¶
func (s *SeriesFloat64) Swap(row1, row2 int, opts ...Options)
Swap is used to swap 2 values based on their row position.
func (*SeriesFloat64) Table ¶
func (s *SeriesFloat64) Table(opts ...TableOptions) string
Table will produce the Series in a table.
func (*SeriesFloat64) ToSeriesFloat64 ¶
func (s *SeriesFloat64) ToSeriesFloat64(ctx context.Context, removeNil bool, conv ...func(interface{}) (float64, error)) (*SeriesFloat64, error)
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.
func (*SeriesFloat64) ToSeriesMixed ¶
func (s *SeriesFloat64) ToSeriesMixed(ctx context.Context, removeNil bool, conv ...func(interface{}) (interface{}, error)) (*SeriesMixed, error)
ToSeriesMixed will convert the Series to a SeriesMIxed. The operation does not lock the Series.
func (*SeriesFloat64) ToSeriesString ¶
func (s *SeriesFloat64) ToSeriesString(ctx context.Context, removeNil bool, conv ...func(interface{}) (*string, error)) (*SeriesString, error)
ToSeriesString will convert the Series to a SeriesString. The operation does not lock the Series.
func (*SeriesFloat64) Type ¶
func (s *SeriesFloat64) Type() string
Type returns the type of data the series holds.
func (*SeriesFloat64) Unlock ¶
func (s *SeriesFloat64) Unlock()
Unlock will unlock the Series that was previously locked.
func (*SeriesFloat64) Update ¶
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 (*SeriesFloat64) 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.
func (*SeriesFloat64) ValueString ¶
func (s *SeriesFloat64) ValueString(row int, opts ...Options) string
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 (*SeriesFloat64) ValuesIterator ¶
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 ¶
type SeriesGeneric struct {
// contains filtered or unexported fields
}
SeriesGeneric is a series of data where the contained data can be of any type. Only concrete data types can be used.
func NewSeriesGeneric ¶
func NewSeriesGeneric(name string, concreteType interface{}, init *SeriesInit, vals ...interface{}) *SeriesGeneric
NewSeriesGeneric creates a new generic series.
func (*SeriesGeneric) Append ¶
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 (*SeriesGeneric) ContainsNil ¶
func (s *SeriesGeneric) ContainsNil(opts ...Options) bool
ContainsNil will return whether or not the series contains any nil values.
func (*SeriesGeneric) Copy ¶
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 (*SeriesGeneric) Insert ¶
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.
func (*SeriesGeneric) IsEqual ¶
func (s *SeriesGeneric) IsEqual(ctx context.Context, s2 Series, opts ...IsEqualOptions) (bool, error)
IsEqual returns true if s2's values are equal to s.
func (*SeriesGeneric) IsEqualFunc ¶
func (s *SeriesGeneric) IsEqualFunc(a, b interface{}) bool
IsEqualFunc returns true if a is equal to b.
func (*SeriesGeneric) IsLessThanFunc ¶
func (s *SeriesGeneric) IsLessThanFunc(a, b interface{}) bool
IsLessThanFunc returns true if a is less than b.
func (*SeriesGeneric) Lock ¶
func (s *SeriesGeneric) Lock()
Lock will lock the Series allowing you to directly manipulate the underlying slice with confidence.
func (*SeriesGeneric) NRows ¶
func (s *SeriesGeneric) NRows(opts ...Options) int
NRows returns how many rows the series contains.
func (*SeriesGeneric) Name ¶
func (s *SeriesGeneric) Name(opts ...Options) string
Name returns the series name.
func (*SeriesGeneric) NilCount ¶
func (s *SeriesGeneric) NilCount(opts ...NilCountOptions) (int, error)
NilCount will return how many nil values are in the series.
func (*SeriesGeneric) Prepend ¶
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 (*SeriesGeneric) Remove ¶
func (s *SeriesGeneric) Remove(row int, opts ...Options)
Remove is used to delete the value of a particular row.
func (*SeriesGeneric) Rename ¶
func (s *SeriesGeneric) Rename(n string, opts ...Options)
Rename renames the series.
func (*SeriesGeneric) Reset ¶
func (s *SeriesGeneric) Reset(opts ...Options)
Reset is used clear all data contained in the Series.
func (*SeriesGeneric) SetIsEqualFunc ¶
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 (*SeriesGeneric) SetIsLessThanFunc ¶
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 (*SeriesGeneric) SetValueToStringFormatter ¶
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.
func (*SeriesGeneric) Sort ¶
func (s *SeriesGeneric) Sort(ctx context.Context, opts ...SortOptions) (completed bool)
Sort will sort the series. It will return true if sorting was completed or false when the context is canceled.
func (*SeriesGeneric) String ¶
func (s *SeriesGeneric) String() string
String implements the fmt.Stringer interface. It does not lock the Series.
func (*SeriesGeneric) Swap ¶
func (s *SeriesGeneric) Swap(row1, row2 int, opts ...Options)
Swap is used to swap 2 values based on their row position.
func (*SeriesGeneric) Table ¶
func (s *SeriesGeneric) Table(opts ...TableOptions) string
Table will produce the Series in a table.
func (*SeriesGeneric) ToSeriesMixed ¶
func (s *SeriesGeneric) ToSeriesMixed(ctx context.Context, removeNil bool, conv ...func(interface{}) (interface{}, error)) (*SeriesMixed, error)
ToSeriesMixed will convert the Series to a SeriesMIxed. The operation does not lock the Series.
func (*SeriesGeneric) Type ¶
func (s *SeriesGeneric) Type() string
Type returns the type of data the series holds.
func (*SeriesGeneric) Unlock ¶
func (s *SeriesGeneric) Unlock()
Unlock will unlock the Series that was previously locked.
func (*SeriesGeneric) Update ¶
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 (*SeriesGeneric) 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.
func (*SeriesGeneric) ValueString ¶
func (s *SeriesGeneric) ValueString(row int, opts ...Options) string
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 (*SeriesGeneric) ValuesIterator ¶
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 ¶
type SeriesInit struct { // Prefill the series with nil ("NaN") with // Size number of rows. Size int // How much memory to preallocate. // If you know the size of the series in advance, // it is better to preallocate the capacity of the // underlying slice. Capacity int }
SeriesInit is used to configure the series when it is initialized
type SeriesInt64 ¶
type SeriesInt64 struct {
// contains filtered or unexported fields
}
SeriesInt64 is used for series containing int64 data.
func NewSeriesInt64 ¶
func NewSeriesInt64(name string, init *SeriesInit, vals ...interface{}) *SeriesInt64
NewSeriesInt64 creates a new series with the underlying type as int64.
func (*SeriesInt64) Append ¶
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 (*SeriesInt64) ContainsNil ¶
func (s *SeriesInt64) ContainsNil(opts ...Options) bool
ContainsNil will return whether or not the series contains any nil values.
func (*SeriesInt64) Copy ¶
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 ¶
func (s *SeriesInt64) FillRand(src rand.Source, probNil float64, rander Rander, opts ...FillRandOptions)
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 (*SeriesInt64) Insert ¶
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.
func (*SeriesInt64) IsEqual ¶
func (s *SeriesInt64) IsEqual(ctx context.Context, s2 Series, opts ...IsEqualOptions) (bool, error)
IsEqual returns true if s2's values are equal to s.
func (*SeriesInt64) IsEqualFunc ¶
func (s *SeriesInt64) IsEqualFunc(a, b interface{}) bool
IsEqualFunc returns true if a is equal to b.
func (*SeriesInt64) IsLessThanFunc ¶
func (s *SeriesInt64) IsLessThanFunc(a, b interface{}) bool
IsLessThanFunc returns true if a is less than b.
func (*SeriesInt64) Lock ¶
func (s *SeriesInt64) Lock()
Lock will lock the Series allowing you to directly manipulate the underlying slice with confidence.
func (*SeriesInt64) Mean ¶
func (s *SeriesInt64) Mean(ctx context.Context) (float64, error)
Mean returns the mean. All non-nil values are ignored.
func (*SeriesInt64) NRows ¶
func (s *SeriesInt64) NRows(opts ...Options) int
NRows returns how many rows the series contains.
func (*SeriesInt64) Name ¶
func (s *SeriesInt64) Name(opts ...Options) string
Name returns the series name.
func (*SeriesInt64) NewSeries ¶
func (s *SeriesInt64) NewSeries(name string, init *SeriesInit) Series
NewSeries creates a new initialized SeriesInt64.
func (*SeriesInt64) NilCount ¶
func (s *SeriesInt64) NilCount(opts ...NilCountOptions) (int, error)
NilCount will return how many nil values are in the series.
func (*SeriesInt64) Prepend ¶
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 (*SeriesInt64) Remove ¶
func (s *SeriesInt64) Remove(row int, opts ...Options)
Remove is used to delete the value of a particular row.
func (*SeriesInt64) Rename ¶
func (s *SeriesInt64) Rename(n string, opts ...Options)
Rename renames the series.
func (*SeriesInt64) Reset ¶
func (s *SeriesInt64) Reset(opts ...Options)
Reset is used clear all data contained in the Series.
func (*SeriesInt64) SetValueToStringFormatter ¶
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.
func (*SeriesInt64) Sort ¶
func (s *SeriesInt64) Sort(ctx context.Context, opts ...SortOptions) (completed bool)
Sort will sort the series. It will return true if sorting was completed or false when the context is canceled.
func (*SeriesInt64) String ¶
func (s *SeriesInt64) String() string
String implements the fmt.Stringer interface. It does not lock the Series.
func (*SeriesInt64) Sum ¶
func (s *SeriesInt64) Sum(ctx context.Context) (float64, error)
Sum returns the sum of all non-nil values. If all values are nil, a NaN is returned.
func (*SeriesInt64) Swap ¶
func (s *SeriesInt64) Swap(row1, row2 int, opts ...Options)
Swap is used to swap 2 values based on their row position.
func (*SeriesInt64) Table ¶
func (s *SeriesInt64) Table(opts ...TableOptions) string
Table will produce the Series in a table.
func (*SeriesInt64) ToSeriesFloat64 ¶
func (s *SeriesInt64) ToSeriesFloat64(ctx context.Context, removeNil bool, conv ...func(interface{}) (float64, error)) (*SeriesFloat64, error)
ToSeriesFloat64 will convert the Series to a SeriesFloat64. The operation does not lock the Series.
func (*SeriesInt64) ToSeriesMixed ¶
func (s *SeriesInt64) ToSeriesMixed(ctx context.Context, removeNil bool, conv ...func(interface{}) (interface{}, error)) (*SeriesMixed, error)
ToSeriesMixed will convert the Series to a SeriesMIxed. The operation does not lock the Series.
func (*SeriesInt64) ToSeriesString ¶
func (s *SeriesInt64) ToSeriesString(ctx context.Context, removeNil bool, conv ...func(interface{}) (*string, error)) (*SeriesString, error)
ToSeriesString will convert the Series to a SeriesString. The operation does not lock the Series.
func (*SeriesInt64) Type ¶
func (s *SeriesInt64) Type() string
Type returns the type of data the series holds.
func (*SeriesInt64) Unlock ¶
func (s *SeriesInt64) Unlock()
Unlock will unlock the Series that was previously locked.
func (*SeriesInt64) Update ¶
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 (*SeriesInt64) 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.
func (*SeriesInt64) ValueString ¶
func (s *SeriesInt64) ValueString(row int, opts ...Options) string
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 (*SeriesInt64) ValuesIterator ¶
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 ¶
type SeriesMixed struct {
// contains filtered or unexported fields
}
SeriesMixed is used for series containing mixed data.
func NewSeriesMixed ¶
func NewSeriesMixed(name string, init *SeriesInit, vals ...interface{}) *SeriesMixed
NewSeriesMixed creates a new series with the underlying type as interface{}.
func (*SeriesMixed) Append ¶
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 (*SeriesMixed) ContainsNil ¶
func (s *SeriesMixed) ContainsNil(opts ...Options) bool
ContainsNil will return whether or not the series contains any nil values.
func (*SeriesMixed) Copy ¶
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 ¶
func (s *SeriesMixed) FillRand(src rand.Source, probNil float64, rander Rander, opts ...FillRandOptions)
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 (*SeriesMixed) Insert ¶
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.
func (*SeriesMixed) IsEqual ¶
func (s *SeriesMixed) IsEqual(ctx context.Context, s2 Series, opts ...IsEqualOptions) (bool, error)
IsEqual returns true if s2's values are equal to s.
func (*SeriesMixed) IsEqualFunc ¶
func (s *SeriesMixed) IsEqualFunc(a, b interface{}) bool
IsEqualFunc returns true if a is equal to b.
func (*SeriesMixed) IsLessThanFunc ¶
func (s *SeriesMixed) IsLessThanFunc(a, b interface{}) bool
IsLessThanFunc returns true if a is less than b.
func (*SeriesMixed) Lock ¶
func (s *SeriesMixed) Lock()
Lock will lock the Series allowing you to directly manipulate the underlying slice with confidence.
func (*SeriesMixed) NRows ¶
func (s *SeriesMixed) NRows(opts ...Options) int
NRows returns how many rows the series contains.
func (*SeriesMixed) Name ¶
func (s *SeriesMixed) Name(opts ...Options) string
Name returns the series name.
func (*SeriesMixed) NewSeries ¶
func (s *SeriesMixed) NewSeries(name string, init *SeriesInit) Series
NewSeries creates a new initialized SeriesMixed.
func (*SeriesMixed) NilCount ¶
func (s *SeriesMixed) NilCount(opts ...NilCountOptions) (int, error)
NilCount will return how many nil values are in the series.
func (*SeriesMixed) Prepend ¶
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 (*SeriesMixed) Remove ¶
func (s *SeriesMixed) Remove(row int, opts ...Options)
Remove is used to delete the value of a particular row.
func (*SeriesMixed) Rename ¶
func (s *SeriesMixed) Rename(n string, opts ...Options)
Rename renames the series.
func (*SeriesMixed) Reset ¶
func (s *SeriesMixed) Reset(opts ...Options)
Reset is used clear all data contained in the Series.
func (*SeriesMixed) SetIsEqualFunc ¶
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 (*SeriesMixed) SetIsLessThanFunc ¶
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 (*SeriesMixed) SetValueToStringFormatter ¶
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.
func (*SeriesMixed) Sort ¶
func (s *SeriesMixed) Sort(ctx context.Context, opts ...SortOptions) (completed bool)
Sort will sort the series. It will return true if sorting was completed or false when the context is canceled.
func (*SeriesMixed) String ¶
func (s *SeriesMixed) String() string
String implements the fmt.Stringer interface. It does not lock the Series.
func (*SeriesMixed) Swap ¶
func (s *SeriesMixed) Swap(row1, row2 int, opts ...Options)
Swap is used to swap 2 values based on their row position.
func (*SeriesMixed) Table ¶
func (s *SeriesMixed) Table(opts ...TableOptions) string
Table will produce the Series in a table.
func (*SeriesMixed) ToSeriesString ¶
func (s *SeriesMixed) ToSeriesString(ctx context.Context, removeNil bool, conv ...func(interface{}) (*string, error)) (*SeriesString, error)
ToSeriesString will convert the Series to a SeriesString. The operation does not lock the Series.
func (*SeriesMixed) Type ¶
func (s *SeriesMixed) Type() string
Type returns the type of data the series holds.
func (*SeriesMixed) Unlock ¶
func (s *SeriesMixed) Unlock()
Unlock will unlock the Series that was previously locked.
func (*SeriesMixed) Update ¶
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 (*SeriesMixed) 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.
func (*SeriesMixed) ValueString ¶
func (s *SeriesMixed) ValueString(row int, opts ...Options) string
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 (*SeriesMixed) ValuesIterator ¶
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 ¶
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 forces the series' index to be returned as a map key. SeriesIdx SeriesReturnOpt = 1 << iota // SeriesName forces the series' name to be returned as a map key. SeriesName )
type SeriesString ¶
type SeriesString struct {
// contains filtered or unexported fields
}
SeriesString is used for series containing string data.
func NewSeriesString ¶
func NewSeriesString(name string, init *SeriesInit, vals ...interface{}) *SeriesString
NewSeriesString creates a new series with the underlying type as string.
func (*SeriesString) Append ¶
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 (*SeriesString) ContainsNil ¶
func (s *SeriesString) ContainsNil(opts ...Options) bool
ContainsNil will return whether or not the series contains any nil values.
func (*SeriesString) Copy ¶
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 ¶
func (s *SeriesString) FillRand(src rand.Source, probNil float64, rander Rander, opts ...FillRandOptions)
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 (*SeriesString) Insert ¶
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.
func (*SeriesString) IsEqual ¶
func (s *SeriesString) IsEqual(ctx context.Context, s2 Series, opts ...IsEqualOptions) (bool, error)
IsEqual returns true if s2's values are equal to s.
func (*SeriesString) IsEqualFunc ¶
func (s *SeriesString) IsEqualFunc(a, b interface{}) bool
IsEqualFunc returns true if a is equal to b.
func (*SeriesString) IsLessThanFunc ¶
func (s *SeriesString) IsLessThanFunc(a, b interface{}) bool
IsLessThanFunc returns true if a is less than b.
func (*SeriesString) Lock ¶
func (s *SeriesString) Lock()
Lock will lock the Series allowing you to directly manipulate the underlying slice with confidence.
func (*SeriesString) NRows ¶
func (s *SeriesString) NRows(opts ...Options) int
NRows returns how many rows the series contains.
func (*SeriesString) Name ¶
func (s *SeriesString) Name(opts ...Options) string
Name returns the series name.
func (*SeriesString) NewSeries ¶
func (s *SeriesString) NewSeries(name string, init *SeriesInit) Series
NewSeries creates a new initialized SeriesString.
func (*SeriesString) NilCount ¶
func (s *SeriesString) NilCount(opts ...NilCountOptions) (int, error)
NilCount will return how many nil values are in the series.
func (*SeriesString) Prepend ¶
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 (*SeriesString) Remove ¶
func (s *SeriesString) Remove(row int, opts ...Options)
Remove is used to delete the value of a particular row.
func (*SeriesString) Rename ¶
func (s *SeriesString) Rename(n string, opts ...Options)
Rename renames the series.
func (*SeriesString) Reset ¶
func (s *SeriesString) Reset(opts ...Options)
Reset is used clear all data contained in the Series.
func (*SeriesString) SetValueToStringFormatter ¶
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.
func (*SeriesString) Sort ¶
func (s *SeriesString) Sort(ctx context.Context, opts ...SortOptions) (completed bool)
Sort will sort the series. It will return true if sorting was completed or false when the context is canceled.
func (*SeriesString) String ¶
func (s *SeriesString) String() string
String implements the fmt.Stringer interface. It does not lock the Series.
func (*SeriesString) Swap ¶
func (s *SeriesString) Swap(row1, row2 int, opts ...Options)
Swap is used to swap 2 values based on their row position.
func (*SeriesString) Table ¶
func (s *SeriesString) Table(opts ...TableOptions) string
Table will produce the Series in a table.
func (*SeriesString) ToSeriesFloat64 ¶
func (s *SeriesString) ToSeriesFloat64(ctx context.Context, removeNil bool, conv ...func(interface{}) (float64, error)) (*SeriesFloat64, error)
ToSeriesFloat64 will convert the Series to a SeriesFloat64. The operation does not lock the Series.
func (*SeriesString) ToSeriesInt64 ¶
func (s *SeriesString) ToSeriesInt64(ctx context.Context, removeNil bool, conv ...func(interface{}) (*int64, error)) (*SeriesInt64, error)
ToSeriesInt64 will convert the Series to a SeriesInt64. The operation does not lock the Series.
func (*SeriesString) ToSeriesMixed ¶
func (s *SeriesString) ToSeriesMixed(ctx context.Context, removeNil bool, conv ...func(interface{}) (interface{}, error)) (*SeriesMixed, error)
ToSeriesMixed will convert the Series to a SeriesMIxed. The operation does not lock the Series.
func (*SeriesString) Type ¶
func (s *SeriesString) Type() string
Type returns the type of data the series holds.
func (*SeriesString) Unlock ¶
func (s *SeriesString) Unlock()
Unlock will unlock the Series that was previously locked.
func (*SeriesString) Update ¶
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 (*SeriesString) 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.
func (*SeriesString) ValueString ¶
func (s *SeriesString) ValueString(row int, opts ...Options) string
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 (*SeriesString) ValuesIterator ¶
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.
type SeriesTime ¶
type SeriesTime struct { // Layout is for internal use only at the moment. Do not use. // // See: https://golang.org/pkg/time/#Parse Layout string // Values is exported to better improve interoperability with various sub-packages. // // WARNING: Do not modify directly. Values []*time.Time // contains filtered or unexported fields }
SeriesTime is used for series containing time.Time data.
func NewSeriesTime ¶
func NewSeriesTime(name string, init *SeriesInit, vals ...interface{}) *SeriesTime
NewSeriesTime creates a new series with the underlying type as time.Time.
func (*SeriesTime) Append ¶
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 (*SeriesTime) ContainsNil ¶
func (s *SeriesTime) ContainsNil(opts ...Options) bool
ContainsNil will return whether or not the series contains any nil values.
func (*SeriesTime) Copy ¶
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 ¶
func (s *SeriesTime) FillRand(src rand.Source, probNil float64, rander Rander, opts ...FillRandOptions)
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 (*SeriesTime) Insert ¶
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.
func (*SeriesTime) IsEqual ¶
func (s *SeriesTime) IsEqual(ctx context.Context, s2 Series, opts ...IsEqualOptions) (bool, error)
IsEqual returns true if s2's values are equal to s.
func (*SeriesTime) IsEqualFunc ¶
func (s *SeriesTime) IsEqualFunc(a, b interface{}) bool
IsEqualFunc returns true if a is equal to b.
func (*SeriesTime) IsLessThanFunc ¶
func (s *SeriesTime) IsLessThanFunc(a, b interface{}) bool
IsLessThanFunc returns true if a is less than b.
func (*SeriesTime) Lock ¶
func (s *SeriesTime) Lock()
Lock will lock the Series allowing you to directly manipulate the underlying slice with confidence.
func (*SeriesTime) NRows ¶
func (s *SeriesTime) NRows(opts ...Options) int
NRows returns how many rows the series contains.
func (*SeriesTime) Name ¶
func (s *SeriesTime) Name(opts ...Options) string
Name returns the series name.
func (*SeriesTime) NewSeries ¶
func (s *SeriesTime) NewSeries(name string, init *SeriesInit) Series
NewSeries creates a new initialized SeriesTime.
func (*SeriesTime) NilCount ¶
func (s *SeriesTime) NilCount(opts ...NilCountOptions) (int, error)
NilCount will return how many nil values are in the series.
func (*SeriesTime) Prepend ¶
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 (*SeriesTime) Remove ¶
func (s *SeriesTime) Remove(row int, opts ...Options)
Remove is used to delete the value of a particular row.
func (*SeriesTime) Rename ¶
func (s *SeriesTime) Rename(n string, opts ...Options)
Rename renames the series.
func (*SeriesTime) Reset ¶
func (s *SeriesTime) Reset(opts ...Options)
Reset is used clear all data contained in the Series.
func (*SeriesTime) SetValueToStringFormatter ¶
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.
func (*SeriesTime) Sort ¶
func (s *SeriesTime) Sort(ctx context.Context, opts ...SortOptions) (completed bool)
Sort will sort the series. It will return true if sorting was completed or false when the context is canceled.
func (*SeriesTime) String ¶
func (s *SeriesTime) String() string
String implements the fmt.Stringer interface. It does not lock the Series.
func (*SeriesTime) Swap ¶
func (s *SeriesTime) Swap(row1, row2 int, opts ...Options)
Swap is used to swap 2 values based on their row position.
func (*SeriesTime) Table ¶
func (s *SeriesTime) Table(opts ...TableOptions) string
Table will produce the Series in a table.
func (*SeriesTime) ToSeriesFloat64 ¶
func (s *SeriesTime) ToSeriesFloat64(ctx context.Context, removeNil bool, conv ...func(interface{}) (float64, error)) (*SeriesFloat64, error)
ToSeriesFloat64 will convert the Series to a SeriesFloat64. The time format is Unix seconds. The operation does not lock the Series.
func (*SeriesTime) ToSeriesInt64 ¶
func (s *SeriesTime) ToSeriesInt64(ctx context.Context, removeNil bool, conv ...func(interface{}) (*int64, error)) (*SeriesInt64, error)
ToSeriesInt64 will convert the Series to a SeriesInt64. The time format is Unix seconds. The operation does not lock the Series.
func (*SeriesTime) ToSeriesMixed ¶
func (s *SeriesTime) ToSeriesMixed(ctx context.Context, removeNil bool, conv ...func(interface{}) (interface{}, error)) (*SeriesMixed, error)
ToSeriesMixed will convert the Series to a SeriesMIxed. The operation does not lock the Series.
func (*SeriesTime) Type ¶
func (s *SeriesTime) Type() string
Type returns the type of data the series holds.
func (*SeriesTime) Unlock ¶
func (s *SeriesTime) Unlock()
Unlock will unlock the Series that was previously locked.
func (*SeriesTime) Update ¶
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 (*SeriesTime) 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.
func (*SeriesTime) ValueString ¶
func (s *SeriesTime) ValueString(row int, opts ...Options) string
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 (*SeriesTime) ValuesIterator ¶
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 ¶
type SortKey struct { // Key can be an int (position of series) or string (name of series). Key interface{} // Desc can be set to sort in descending order. Desc bool // contains filtered or unexported fields }
SortKey is the key to sort a Dataframe
type SortOptions ¶
type SortOptions struct { // Stable can be set if the original order of equal items must be maintained. // // See: https://golang.org/pkg/sort/#Stable Stable bool // Desc can be set to sort in descending order. This option is ignored when applied to a Dataframe. // Only use it with a Series. Desc bool // DontLock can be set to true if the Series should not be locked. DontLock bool }
SortOptions is used to configure the sort algorithm for a Dataframe or Series
type TableOptions ¶
type TableOptions struct { // Series is used to display a given set of Series. When nil (default), all Series are displayed. // An index of the Series or the name of the Series can be provided. // // NOTE: This option only applies to DataFrames. // // Example: // // opts := TableOptions{Series: []interface{}{1, "time"}} // Series []interface{} // R is used to limit the range of rows. R *Range // DontLock can be set to true if the DataFrame or Series should not be locked. DontLock bool }
TableOptions can be used to limit the number of rows and which Series are used when generating the table.
type ToSeriesFloat64 ¶
type ToSeriesFloat64 interface { // ToSeriesFloat64 is used to convert a particular Series to a SeriesFloat64. // If the returned Series is not nil but an error is still provided, // it means that some rows were not able to be converted. You can inspect // the error to determine which rows were unconverted. // // NOTE: The returned ErrorCollection should contain RowError objects. ToSeriesFloat64(context.Context, bool, ...func(interface{}) (float64, error)) (*SeriesFloat64, error) }
ToSeriesFloat64 is an interface used by the Dataframe to know if a particular Series can be converted to a SeriesFloat64 Series.
type ToSeriesInt64 ¶
type ToSeriesInt64 interface { // ToSeriesInt64 is used to convert a particular Series to a SeriesInt64. // If the returned Series is not nil but an error is still provided, // it means that some rows were not able to be converted. You can inspect // the error to determine which rows were unconverted. // // NOTE: The returned ErrorCollection should contain RowError objects. ToSeriesInt64(context.Context, bool, ...func(interface{}) (*int64, error)) (*SeriesInt64, error) }
ToSeriesInt64 is an interface used by the Dataframe to know if a particular Series can be converted to a SeriesInt64 Series.
type ToSeriesMixed ¶
type ToSeriesMixed interface { // ToSeriesMixed is used to convert a particular Series to a ToSeriesMixed. // If the returned Series is not nil but an error is still provided, // it means that some rows were not able to be converted. You can inspect // the error to determine which rows were unconverted. // // NOTE: The returned ErrorCollection should contain RowError objects. ToSeriesMixed(context.Context, bool, ...func(interface{}) (interface{}, error)) (*SeriesMixed, error) }
ToSeriesMixed is an interface used by the Dataframe to know if a particular Series can be converted to a ToSeriesMixed Series.
type ToSeriesString ¶
type ToSeriesString interface { // ToSeriesString is used to convert a particular Series to a SeriesString. // If the returned Series is not nil but an error is still provided, // it means that some rows were not able to be converted. You can inspect // the error to determine which rows were unconverted. // // NOTE: The returned ErrorCollection should contain RowError objects. ToSeriesString(context.Context, bool, ...func(interface{}) (*string, error)) (*SeriesString, error) }
ToSeriesString is an interface used by the Dataframe to know if a particular Series can be converted to a SeriesString Series.
type ValueToStringFormatter ¶
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 ¶
type ValuesOptions struct { // InitialRow represents the starting value for iterating. // Negative values are acceptable. A value of -2 means the second last row. InitialRow int // Step represents by how much each iteration should step by. // It can be negative to represent iterating in reverse direction. // InitialRow should be adjusted to -1 if Step is negative. // If Step is 0, the function will panic. Step int // Don't apply read lock. This is useful if you intend to Write lock // the entire dataframe. DontReadLock bool }
ValuesOptions is used to modify the behavior of Values().
Source Files ¶
- apply.go
- conversion.go
- dataframe.go
- dataframe_fmt.go
- error_collection.go
- errors.go
- filter.go
- helpers.go
- ordered_map.go
- range.go
- series.go
- series_defaults.go
- series_float64.go
- series_generic.go
- series_init.go
- series_int64.go
- series_mixed.go
- series_stats.go
- series_string.go
- series_time.go
- series_validation.go
- sort.go
- unsafe.go
Directories ¶
Path | Synopsis |
---|---|
Package exports provides functionality to save the data contained in a DataFrame into another format.
|
Package exports provides functionality to save the data contained in a DataFrame into another format. |
Package forecast provides an interface for custom forecasting algorithms.
|
Package forecast provides an interface for custom forecasting algorithms. |
algs/hw
Package hw implements the Holt-Winters forecasting algorithm.
|
Package hw implements the Holt-Winters forecasting algorithm. |
algs/ses
Package ses implements the simple exponential smooting forecasting algorithm.
|
Package ses implements the simple exponential smooting forecasting algorithm. |
interpolation
Package interpolation implements various algorithms to fill in missing values in a Series or DataFrame.
|
Package interpolation implements various algorithms to fill in missing values in a Series or DataFrame. |
Package imports provides functionality to read data contained in another format to populate a DataFrame.
|
Package imports provides functionality to read data contained in another format to populate a DataFrame. |
math
|
|
funcs
Package funcs provides functionality to apply mathematical functions to DataFrames.
|
Package funcs provides functionality to apply mathematical functions to DataFrames. |
matrix
Package matrix can be used to wrap a DataFrame such that it implements the Matrix interface found in various external packages such as gonum.
|
Package matrix can be used to wrap a DataFrame such that it implements the Matrix interface found in various external packages such as gonum. |
Package pandas contains functionality that mirrors python's popular pandas library.
|
Package pandas contains functionality that mirrors python's popular pandas library. |
Package plot implements basic plotting functionality that leverages Chrome/Chromium for cross-platform capabilities.
|
Package plot implements basic plotting functionality that leverages Chrome/Chromium for cross-platform capabilities. |
faker
Package faker can be used to generate DataFrames filled with fake data.
|
Package faker can be used to generate DataFrames filled with fake data. |
Package xseries contains specialized and/or "exotic" Series types that don't belong in the core package.
|
Package xseries contains specialized and/or "exotic" Series types that don't belong in the core package. |