Documentation
¶
Index ¶
- Variables
- func LogDebug(msg string, args ...interface{})
- func LogFatal(msg string, args ...interface{})
- func LogInfo(msg string, args ...interface{})
- func LogWarning(msg string, args ...interface{})
- func PowRat(base *big.Rat, exponent int) *big.Rat
- func ProcessData(input interface{}) ([]interface{}, int)
- func SetDefaultConfig()
- func SliceToF64(data []interface{}) []float64
- func SqrtRat(x *big.Rat) *big.Rat
- func ToFloat64(v interface{}) float64
- func ToFloat64Safe(v interface{}) (float64, bool)
- type DataList
- func (dl *DataList) Append(values ...interface{})
- func (dl *DataList) Capitalize()
- func (dl *DataList) Clear()
- func (dl *DataList) ClearNumbers()
- func (dl *DataList) ClearStrings()
- func (dl *DataList) Count(value interface{}) int
- func (dl *DataList) Data() []interface{}
- func (dl *DataList) Drop(index int)
- func (dl *DataList) DropAll(toDrop ...interface{})
- func (dl *DataList) DropIfContains(value interface{})
- func (dl *DataList) Filter(filterFunc func(interface{}) bool) *DataList
- func (dl *DataList) FindAll(value interface{}) []int
- func (dl *DataList) FindFirst(value interface{}) interface{}
- func (dl *DataList) FindLast(value interface{}) interface{}
- func (dl *DataList) GMean() interface{}
- func (dl *DataList) Get(index int) interface{}
- func (dl *DataList) GetCreationTimestamp() int64
- func (dl *DataList) GetLastModifiedTimestamp() int64
- func (dl *DataList) GetName() string
- func (dl *DataList) IQR() interface{}
- func (dl *DataList) InsertAt(index int, value interface{})
- func (dl *DataList) Len() int
- func (dl *DataList) Lower()
- func (dl *DataList) Mad() interface{}
- func (dl *DataList) Max() interface{}
- func (dl *DataList) Mean(highPrecision ...bool) interface{}
- func (dl *DataList) Median(highPrecision ...bool) interface{}
- func (dl *DataList) Min() interface{}
- func (dl *DataList) Mode() interface{}
- func (dl *DataList) ParseNumbers()
- func (dl *DataList) ParseStrings()
- func (dl *DataList) Percentile(p float64) interface{}
- func (dl *DataList) Pop() interface{}
- func (dl *DataList) Quartile(q int) interface{}
- func (dl *DataList) Range() interface{}
- func (dl *DataList) ReplaceAll(oldValue, newValue interface{})
- func (dl *DataList) ReplaceFirst(oldValue, newValue interface{})
- func (dl *DataList) ReplaceLast(oldValue, newValue interface{})
- func (dl *DataList) Reverse()
- func (dl *DataList) SetName(newName string) *DataList
- func (dl *DataList) Sort(ascending ...bool)
- func (dl *DataList) Stdev(highPrecision ...bool) interface{}
- func (dl *DataList) StdevP(highPrecision ...bool) interface{}
- func (dl *DataList) Sum() interface{}
- func (dl *DataList) ToF64Slice() []float64
- func (dl *DataList) ToStringSlice() []string
- func (dl *DataList) Update(index int, newValue interface{})
- func (dl *DataList) Upper()
- func (dl *DataList) Var(highPrecision ...bool) interface{}
- func (dl *DataList) VarP(highPrecision ...bool) interface{}
- type DataTable
- func (dt *DataTable) AppendColumns(columns ...*DataList)
- func (dt *DataTable) AppendRowsByIndex(rowsData ...map[string]interface{})
- func (dt *DataTable) AppendRowsByName(rowsData ...map[string]interface{})
- func (dt *DataTable) AppendRowsFromDataList(rowsData ...*DataList)
- func (dt *DataTable) Data(useNamesAsKeys ...bool) map[string][]interface{}
- func (dt *DataTable) DropColumnsByIndex(columnIndices ...string)
- func (dt *DataTable) DropColumnsByName(columnNames ...string)
- func (dt *DataTable) DropColumnsContainNil()
- func (dt *DataTable) DropColumnsContainNumbers()
- func (dt *DataTable) DropColumnsContainStringElements()
- func (dt *DataTable) DropRowsByIndex(rowIndices ...int)
- func (dt *DataTable) DropRowsByName(rowNames ...string)
- func (dt *DataTable) DropRowsContainNil()
- func (dt *DataTable) DropRowsContainNumbers()
- func (dt *DataTable) DropRowsContainStringElements()
- func (dt *DataTable) Filter(filterFunc FilterFunc) *DataTable
- func (dt *DataTable) FilterByColumnIndexEqualTo(columnLetter string) *DataTable
- func (dt *DataTable) FilterByColumnIndexGreaterThan(columnLetter string) *DataTable
- func (dt *DataTable) FilterByColumnIndexGreaterThanOrEqualTo(columnLetter string) *DataTable
- func (dt *DataTable) FilterByColumnIndexLessThan(columnLetter string) *DataTable
- func (dt *DataTable) FilterByColumnIndexLessThanOrEqualTo(columnLetter string) *DataTable
- func (dt *DataTable) FilterByColumnNameContains(substring string) *DataTable
- func (dt *DataTable) FilterByColumnNameEqualTo(columnName string) *DataTable
- func (dt *DataTable) FilterByCustomElement(filterFunc func(value interface{}) bool) *DataTable
- func (dt *DataTable) FilterByRowIndexEqualTo(index int) *DataTable
- func (dt *DataTable) FilterByRowIndexGreaterThan(threshold int) *DataTable
- func (dt *DataTable) FilterByRowIndexGreaterThanOrEqualTo(threshold int) *DataTable
- func (dt *DataTable) FilterByRowIndexLessThan(threshold int) *DataTable
- func (dt *DataTable) FilterByRowIndexLessThanOrEqualTo(threshold int) *DataTable
- func (dt *DataTable) FilterByRowNameContains(substring string) *DataTable
- func (dt *DataTable) FilterByRowNameEqualTo(rowName string) *DataTable
- func (dt *DataTable) FindColumnsIfAllElementsContainSubstring(substring string) []string
- func (dt *DataTable) FindColumnsIfAnyElementContainsSubstring(substring string) []string
- func (dt *DataTable) FindColumnsIfContains(value interface{}) []string
- func (dt *DataTable) FindColumnsIfContainsAll(values ...interface{}) []string
- func (dt *DataTable) FindRowsIfAllElementsContainSubstring(substring string) []int
- func (dt *DataTable) FindRowsIfAnyElementContainsSubstring(substring string) []int
- func (dt *DataTable) FindRowsIfContains(value interface{}) []int
- func (dt *DataTable) FindRowsIfContainsAll(values ...interface{}) []int
- func (dt *DataTable) GetColumn(index string) *DataList
- func (dt *DataTable) GetCreationTimestamp() int64
- func (dt *DataTable) GetElement(rowIndex int, columnIndex string) interface{}
- func (dt *DataTable) GetLastModifiedTimestamp() int64
- func (dt *DataTable) GetRow(index int) *DataList
- func (dt *DataTable) GetRowNameByIndex(index int) string
- func (dt *DataTable) LoadFromCSV(filePath string, setFirstColumnToRowNames bool, setFirstRowToColumnNames bool) error
- func (dt *DataTable) SetRowNameByIndex(index int, name string)
- func (dt *DataTable) Show()
- func (dt *DataTable) ShowTypes()
- func (dt *DataTable) ToCSV(filePath string, setRowNamesToFirstColumn bool, setColumnNamesToFirstRow bool) error
- func (dt *DataTable) UpdateColumn(index string, dl *DataList)
- func (dt *DataTable) UpdateElement(rowIndex int, columnIndex string, value interface{})
- func (dt *DataTable) UpdateRow(index int, dl *DataList)
- type FilterFunc
- type IDataList
- type IDataTable
- type LogLevel
- type NameManager
Constants ¶
This section is empty.
Variables ¶
var Config *configStruct
Functions ¶
func LogWarning ¶
func LogWarning(msg string, args ...interface{})
func ProcessData ¶
func ProcessData(input interface{}) ([]interface{}, int)
ProcessData processes the input data and returns the data and the length of the data. Returns nil and 0 if the data type is unsupported. Supported data types are []interface{} and IDataList.
func SetDefaultConfig ¶
func SetDefaultConfig()
======================== Configs ======================== DefaultConfig returns a Config with default values.
func SliceToF64 ¶
func SliceToF64(data []interface{}) []float64
func ToFloat64 ¶
func ToFloat64(v interface{}) float64
ToFloat64 converts any numeric value to float64.
func ToFloat64Safe ¶
ToFloat64Safe tries to convert any numeric value to float64 and returns a boolean indicating success.
Types ¶
type DataList ¶
type DataList struct {
// contains filtered or unexported fields
}
DataList is a generic dynamic data list.
func NewDataList ¶
func NewDataList(values ...interface{}) *DataList
NewDataList creates a new DataList, supporting both slice and variadic inputs, and flattens the input before storing it.
func (*DataList) Append ¶
func (dl *DataList) Append(values ...interface{})
Append adds a new values to the DataList. The value can be of any type. The value is appended to the end of the DataList.
func (*DataList) Capitalize ¶
func (dl *DataList) Capitalize()
Capitalize capitalizes the first letter of each string element in the DataList.
func (*DataList) Clear ¶
func (dl *DataList) Clear()
Clear removes all elements from the DataList and updates the timestamp.
func (*DataList) ClearNumbers ¶
func (dl *DataList) ClearNumbers()
ClearNumbers removes all numeric elements (int, float, etc.) from the DataList and updates the timestamp.
func (*DataList) ClearStrings ¶
func (dl *DataList) ClearStrings()
ClearStrings removes all string elements from the DataList and updates the timestamp.
func (*DataList) Count ¶ added in v0.0.1
Count returns the number of occurrences of the specified value in the DataList.
func (*DataList) Data ¶
func (dl *DataList) Data() []interface{}
Data returns the data stored in the DataList.
func (*DataList) Drop ¶
Drop removes the element at the specified index from the DataList and updates the timestamp. Returns an error if the index is out of bounds.
func (*DataList) DropAll ¶
func (dl *DataList) DropAll(toDrop ...interface{})
DropAll removes all occurrences of the specified values from the DataList. Supports multiple values to drop.
func (*DataList) DropIfContains ¶ added in v0.0.2
func (dl *DataList) DropIfContains(value interface{})
DropIfContains removes all elements from the DataList that contain the specified value.
func (*DataList) Filter ¶
Filter filters the DataList based on a custom filter function provided by the user. The filter function should return true for elements that should be included in the result.
func (*DataList) FindAll ¶
FindAll returns a slice of all the indices where the specified value is found in the DataList using parallel processing. If the value is not found, it returns an empty slice.
func (*DataList) FindFirst ¶
func (dl *DataList) FindFirst(value interface{}) interface{}
FindFirst returns the index of the first occurrence of the specified value in the DataList. If the value is not found, it returns nil.
func (*DataList) FindLast ¶
func (dl *DataList) FindLast(value interface{}) interface{}
FindLast returns the index of the last occurrence of the specified value in the DataList. If the value is not found, it returns nil.
func (*DataList) GMean ¶
func (dl *DataList) GMean() interface{}
GMean calculates the geometric mean of the DataList. Returns the geometric mean. Returns nil if the DataList is empty. GMean returns the geometric mean of the DataList.
func (*DataList) Get ¶
Get retrieves the value at the specified index in the DataList. Supports negative indexing. Returns nil if the index is out of bounds. Returns the value at the specified index.
func (*DataList) GetCreationTimestamp ¶
GetCreationTimestamp returns the creation time of the DataList in Unix timestamp.
func (*DataList) GetLastModifiedTimestamp ¶
GetLastModifiedTimestamp returns the last updated time of the DataList in Unix timestamp.
func (*DataList) IQR ¶
func (dl *DataList) IQR() interface{}
IQR calculates the interquartile range of the DataList. Returns the interquartile range. Returns nil if the DataList is empty.
func (*DataList) InsertAt ¶
InsertAt inserts a value at the specified index in the DataList. If the index is out of bounds, the value is appended to the end of the list.
func (*DataList) Lower ¶
func (dl *DataList) Lower()
Lower converts all string elements in the DataList to lowercase.
func (*DataList) Mad ¶ added in v0.0.1
func (dl *DataList) Mad() interface{}
Mad calculates the mean absolute deviation of the DataList. Returns the mean absolute deviation. Returns nil if the DataList is empty.
func (*DataList) Max ¶
func (dl *DataList) Max() interface{}
Max returns the maximum value in the DataList. Returns the maximum value. Returns nil if the DataList is empty. Max returns the maximum value in the DataList, or nil if the data types cannot be compared.
func (*DataList) Mean ¶
Mean calculates the arithmetic mean of the DataList. If highPrecision is true, it will calculate using big.Rat for high precision. Otherwise, it calculates using float64. Returns nil if the DataList is empty or if an invalid number of parameters is provided.
func (*DataList) Median ¶
Median calculates the median of the DataList. Returns the median. Returns nil if the DataList is empty. Turn on highPrecision to return a big.Rat instead of a float64.
func (*DataList) Min ¶
func (dl *DataList) Min() interface{}
Min returns the minimum value in the DataList. Returns the minimum value. Returns nil if the DataList is empty. Min returns the minimum value in the DataList, or nil if the data types cannot be compared.
func (*DataList) Mode ¶
func (dl *DataList) Mode() interface{}
Mode calculates the mode of the DataList. Returns the mode. Returns nil if the DataList is empty. Mode returns the mode of the DataList.
func (*DataList) ParseNumbers ¶
func (dl *DataList) ParseNumbers()
ParseNumbers attempts to parse all string elements in the DataList to numeric types. If parsing fails, the element is left unchanged.
func (*DataList) ParseStrings ¶
func (dl *DataList) ParseStrings()
ParseStrings converts all elements in the DataList to strings.
func (*DataList) Percentile ¶
Percentile calculates the percentile based on the input value (0 to 100). Returns the percentile value, or nil if the DataList is empty.
func (*DataList) Pop ¶
func (dl *DataList) Pop() interface{}
Pop removes and returns the last element from the DataList. Returns the last element. Returns nil if the DataList is empty.
func (*DataList) Quartile ¶
Quartile calculates the quartile based on the input value (1 to 3). 1 corresponds to the first quartile (Q1), 2 to the median (Q2), and 3 to the third quartile (Q3).
func (*DataList) Range ¶
func (dl *DataList) Range() interface{}
Range calculates the range of the DataList. Returns the range. Returns nil if the DataList is empty. Range returns the range of the DataList.
func (*DataList) ReplaceAll ¶
func (dl *DataList) ReplaceAll(oldValue, newValue interface{})
ReplaceAll replaces all occurrences of oldValue with newValue in the DataList. If oldValue is not found, no changes are made.
func (*DataList) ReplaceFirst ¶
func (dl *DataList) ReplaceFirst(oldValue, newValue interface{})
ReplaceFirst replaces the first occurrence of oldValue with newValue.
func (*DataList) ReplaceLast ¶
func (dl *DataList) ReplaceLast(oldValue, newValue interface{})
ReplaceLast replaces the last occurrence of oldValue with newValue.
func (*DataList) Reverse ¶
func (dl *DataList) Reverse()
Reverse reverses the order of the elements in the DataList.
func (*DataList) Sort ¶
Sort sorts the DataList using a mixed sorting logic. It handles string, numeric (including all integer and float types), and time data types. If sorting fails, it restores the original order.
func (*DataList) Stdev ¶
Stdev calculates the standard deviation(sample) of the DataList. Returns the standard deviation. Returns nil if the DataList is empty. Stdev returns the standard deviation of the DataList.
func (*DataList) StdevP ¶
StdevP calculates the standard deviation(population) of the DataList. Returns the standard deviation. Returns nil if the DataList is empty or the standard deviation cannot be calculated.
func (*DataList) ToF64Slice ¶
ToF64Slice converts the DataList to a float64 slice. Returns the float64 slice. Returns nil if the DataList is empty. ToF64Slice converts the DataList to a float64 slice.
func (*DataList) ToStringSlice ¶
ToStringSlice converts the DataList to a string slice. Returns the string slice. Returns nil if the DataList is empty.
func (*DataList) Upper ¶
func (dl *DataList) Upper()
Upper converts all string elements in the DataList to uppercase.
type DataTable ¶ added in v0.0.1
type DataTable struct {
// contains filtered or unexported fields
}
func NewDataTable ¶ added in v0.0.1
func (*DataTable) AppendColumns ¶ added in v0.0.1
AppendColumns appends columns to the DataTable, with each column represented by a DataList. If the columns are shorter than the existing columns, nil values will be appended to match the length. If the columns are longer than the existing columns, the existing columns will be extended with nil values.
func (*DataTable) AppendRowsByIndex ¶ added in v0.0.1
AppendRowsByIndex appends rows to the DataTable, with each row represented by a map of column index and value. If the rows are shorter than the existing columns, nil values will be appended to match the length. If the rows are longer than the existing columns, the existing columns will be extended with nil values.
func (*DataTable) AppendRowsByName ¶ added in v0.0.1
AppendRowsByName appends rows to the DataTable, with each row represented by a map of column name and value. If the rows are shorter than the existing columns, nil values will be appended to match the length. If the rows are longer than the existing columns, the existing columns will be extended with nil values.
func (*DataTable) AppendRowsFromDataList ¶ added in v0.0.1
AppendRowsFromDataList appends rows to the DataTable, with each row represented by a DataList. If the rows are shorter than the existing columns, nil values will be appended to match the length. If the rows are longer than the existing columns, the existing columns will be extended with nil values.
func (*DataTable) DropColumnsByIndex ¶ added in v0.0.1
DropColumnsByIndex drops columns by their index names.
func (*DataTable) DropColumnsByName ¶ added in v0.0.1
DropColumnsByName drops columns by their names.
func (*DataTable) DropColumnsContainNil ¶ added in v0.0.2
func (dt *DataTable) DropColumnsContainNil()
DropColumnsContainNil drops columns that contain nil elements.
func (*DataTable) DropColumnsContainNumbers ¶ added in v0.0.2
func (dt *DataTable) DropColumnsContainNumbers()
DropColumnsContainNumbers drops columns that contain number elements.
func (*DataTable) DropColumnsContainStringElements ¶ added in v0.0.2
func (dt *DataTable) DropColumnsContainStringElements()
DropColumnsContainStringElements drops columns that contain string elements.
func (*DataTable) DropRowsByIndex ¶ added in v0.0.1
DropRowsByIndex drops rows by their indices.
func (*DataTable) DropRowsByName ¶ added in v0.0.1
DropRowsByName drops rows by their names.
func (*DataTable) DropRowsContainNil ¶ added in v0.0.2
func (dt *DataTable) DropRowsContainNil()
DropRowsContainNil drops rows that contain nil elements.
func (*DataTable) DropRowsContainNumbers ¶ added in v0.0.2
func (dt *DataTable) DropRowsContainNumbers()
DropRowsContainNumbers drops rows that contain number elements.
func (*DataTable) DropRowsContainStringElements ¶ added in v0.0.2
func (dt *DataTable) DropRowsContainStringElements()
DropRowsContainStringElements drops rows that contain string elements.
func (*DataTable) Filter ¶ added in v0.0.2
func (dt *DataTable) Filter(filterFunc FilterFunc) *DataTable
Filter applies a custom filter function to the DataTable and returns the filtered DataTable.
func (*DataTable) FilterByColumnIndexEqualTo ¶ added in v0.0.2
FilterByColumnIndexEqualTo filters to only keep the column with the specified index.
func (*DataTable) FilterByColumnIndexGreaterThan ¶ added in v0.0.2
FilterByColumnIndexGreaterThan filters columns with index greater than the specified column.
func (*DataTable) FilterByColumnIndexGreaterThanOrEqualTo ¶ added in v0.0.2
FilterByColumnIndexGreaterThanOrEqualTo filters columns with index greater than or equal to the specified column.
func (*DataTable) FilterByColumnIndexLessThan ¶ added in v0.0.2
FilterByColumnIndexLessThan filters columns with index less than the specified column.
func (*DataTable) FilterByColumnIndexLessThanOrEqualTo ¶ added in v0.0.2
FilterByColumnIndexLessThanOrEqualTo filters columns with index less than or equal to the specified column.
func (*DataTable) FilterByColumnNameContains ¶ added in v0.0.2
FilterByColumnNameContains filters columns whose name contains the specified substring.
func (*DataTable) FilterByColumnNameEqualTo ¶ added in v0.0.2
FilterByColumnNameEqualTo filters to only keep the column with the specified name.
func (*DataTable) FilterByCustomElement ¶ added in v0.0.2
FilterByCustomElement filters the table based on a custom function applied to each element.
func (*DataTable) FilterByRowIndexEqualTo ¶ added in v0.0.2
FilterByRowIndexEqualTo filters to only keep the row with the specified index.
func (*DataTable) FilterByRowIndexGreaterThan ¶ added in v0.0.2
FilterByRowIndexGreaterThan filters rows with index greater than the specified threshold.
func (*DataTable) FilterByRowIndexGreaterThanOrEqualTo ¶ added in v0.0.2
FilterByRowIndexGreaterThanOrEqualTo filters rows with index greater than or equal to the specified threshold.
func (*DataTable) FilterByRowIndexLessThan ¶ added in v0.0.2
FilterByRowIndexLessThan filters rows with index less than the specified threshold.
func (*DataTable) FilterByRowIndexLessThanOrEqualTo ¶ added in v0.0.2
FilterByRowIndexLessThanOrEqualTo filters rows with index less than or equal to the specified threshold.
func (*DataTable) FilterByRowNameContains ¶ added in v0.0.2
FilterByRowNameContains filters rows whose name contains the specified substring.
func (*DataTable) FilterByRowNameEqualTo ¶ added in v0.0.2
FilterByRowNameEqualTo filters to only keep the row with the specified name.
func (*DataTable) FindColumnsIfAllElementsContainSubstring ¶ added in v0.0.2
FindColumnsIfAllElementsContainSubstring returns the indices of columns that contain all elements that contain the given substring.
func (*DataTable) FindColumnsIfAnyElementContainsSubstring ¶ added in v0.0.2
FindColumnsIfAnyElementContainsSubstring returns the indices of columns that contain at least one element that contains the given substring.
func (*DataTable) FindColumnsIfContains ¶ added in v0.0.2
FindColumnsIfContains returns the indices of columns that contain the given element.
func (*DataTable) FindColumnsIfContainsAll ¶ added in v0.0.2
FindColumnsIfContainsAll returns the indices of columns that contain all the given elements.
func (*DataTable) FindRowsIfAllElementsContainSubstring ¶ added in v0.0.2
FindRowsIfAllElementsContainSubstring returns the indices of rows that contain all elements that contain the given substring.
func (*DataTable) FindRowsIfAnyElementContainsSubstring ¶ added in v0.0.2
FindRowsIfAnyElementContainsSubstring returns the indices of rows that contain at least one element that contains the given substring.
func (*DataTable) FindRowsIfContains ¶ added in v0.0.2
FindRowsIfContains returns the indices of rows that contain the given element.
func (*DataTable) FindRowsIfContainsAll ¶ added in v0.0.2
FindRowsIfContainsAll returns the indices of rows that contain all the given elements.
func (*DataTable) GetColumn ¶ added in v0.0.2
GetColumn returns a new DataList containing the data of the column with the given index.
func (*DataTable) GetCreationTimestamp ¶ added in v0.0.1
func (*DataTable) GetElement ¶ added in v0.0.2
GetElement returns the element at the given row and column index.
func (*DataTable) GetLastModifiedTimestamp ¶ added in v0.0.1
func (*DataTable) GetRow ¶ added in v0.0.2
GetRow returns a new DataList containing the data of the row with the given index.
func (*DataTable) GetRowNameByIndex ¶ added in v0.0.2
GetRowNameByIndex returns the name of the row at the given index.
func (*DataTable) LoadFromCSV ¶ added in v0.0.3
func (dt *DataTable) LoadFromCSV(filePath string, setFirstColumnToRowNames bool, setFirstRowToColumnNames bool) error
LoadFromCSV loads a CSV file into a DataTable, with options to set the first column as row names and the first row as column names.
func (*DataTable) SetRowNameByIndex ¶ added in v0.0.2
func (*DataTable) ToCSV ¶ added in v0.0.3
func (dt *DataTable) ToCSV(filePath string, setRowNamesToFirstColumn bool, setColumnNamesToFirstRow bool) error
ToCSV converts the DataTable to CSV format and writes it to the provided file path. The function accepts two parameters: - filePath: the file path to write the CSV file to - setRowNamesToFirstColumn: if true, the first column will be used as row names - setColumnNamesToFirstRow: if true, the first row will be used as column names
func (*DataTable) UpdateColumn ¶ added in v0.0.2
UpdateColumn updates the column with the given index.
func (*DataTable) UpdateElement ¶ added in v0.0.2
UpdateElement updates the element at the given row and column index.
type FilterFunc ¶ added in v0.0.2
FilterFunc is a custom filter function that takes the row index, column name, and value as input and returns a boolean.
type IDataList ¶
type IDataList interface {
GetCreationTimestamp() int64
GetLastModifiedTimestamp() int64
GetName() string
SetName(string) *DataList
Data() []interface{}
Append(values ...interface{})
Get(index int) interface{}
Count(interface{}) int
Update(index int, value interface{})
InsertAt(index int, value interface{})
FindFirst(interface{}) interface{}
FindLast(interface{}) interface{}
FindAll(interface{}) []int
Filter(func(interface{}) bool) *DataList
ReplaceFirst(interface{}, interface{})
ReplaceLast(interface{}, interface{})
ReplaceAll(interface{}, interface{})
Pop() interface{}
Drop(index int)
DropAll(...interface{})
DropIfContains(interface{})
Clear()
ClearStrings()
ClearNumbers()
Len() int
Sort(acending ...bool)
Reverse()
Upper()
Lower()
Capitalize()
Sum() interface{}
Max() interface{}
Min() interface{}
Mean(highPrecision ...bool) interface{}
GMean() interface{}
Median(highPrecision ...bool) interface{}
Mode() interface{}
Mad() interface{}
Stdev(highPrecision ...bool) interface{}
StdevP(highPrecision ...bool) interface{}
Var(highPrecision ...bool) interface{}
VarP(highPrecision ...bool) interface{}
Range() interface{}
Quartile(int) interface{}
IQR() interface{}
Percentile(float64) interface{}
ParseNumbers()
ParseStrings()
ToF64Slice() []float64
ToStringSlice() []string
// contains filtered or unexported methods
}
IDataList defines the behavior expected from a DataList.
type IDataTable ¶ added in v0.0.1
type IDataTable interface {
AppendColumns(columns ...*DataList)
AppendRowsFromDataList(rowsData ...*DataList)
AppendRowsByIndex(rowsData ...map[string]interface{})
AppendRowsByName(rowsData ...map[string]interface{})
GetElement(rowIndex int, columnIndex string) interface{}
GetColumn(index string) *DataList
GetRow(index int) *DataList
UpdateElement(rowIndex int, columnIndex string, value interface{})
UpdateColumn(index string, dl *DataList)
UpdateRow(index int, dl *DataList)
FindRowsIfContains(value interface{}) []int
FindRowsIfContainsAll(values ...interface{}) []int
FindRowsIfAnyElementContainsSubstring(substring string) []int
FindRowsIfAllElementsContainSubstring(substring string) []int
FindColumnsIfContains(value interface{}) []string
FindColumnsIfContainsAll(values ...interface{}) []string
FindColumnsIfAnyElementContainsSubstring(substring string) []string
FindColumnsIfAllElementsContainSubstring(substring string) []string
DropColumnsByName(columnNames ...string)
DropColumnsByIndex(columnIndices ...string)
DropColumnsContainStringElements()
DropColumnsContainNumbers()
DropColumnsContainNil()
DropRowsByIndex(rowIndices ...int)
DropRowsByName(rowNames ...string)
DropRowsContainStringElements()
DropRowsContainNumbers()
DropRowsContainNil()
Data(useNamesAsKeys ...bool) map[string][]interface{}
Show()
ShowTypes()
GetRowNameByIndex(index int) string
SetRowNameByIndex(index int, name string)
GetCreationTimestamp() int64
GetLastModifiedTimestamp() int64
// Filters
Filter(filterFunc FilterFunc) *DataTable
FilterByCustomElement(f func(value interface{}) bool) *DataTable
FilterByColumnIndexGreaterThan(threshold string) *DataTable
FilterByColumnIndexGreaterThanOrEqualTo(threshold string) *DataTable
FilterByColumnIndexLessThan(threshold string) *DataTable
FilterByColumnIndexLessThanOrEqualTo(threshold string) *DataTable
FilterByColumnIndexEqualTo(index string) *DataTable
FilterByColumnNameEqualTo(name string) *DataTable
FilterByColumnNameContains(substring string) *DataTable
FilterByRowNameEqualTo(name string) *DataTable
FilterByRowNameContains(substring string) *DataTable
FilterByRowIndexGreaterThan(threshold int) *DataTable
FilterByRowIndexGreaterThanOrEqualTo(threshold int) *DataTable
FilterByRowIndexLessThan(threshold int) *DataTable
FilterByRowIndexLessThanOrEqualTo(threshold int) *DataTable
FilterByRowIndexEqualTo(index int) *DataTable
// CSV
ToCSV(filePath string, setRowNamesToFirstColumn bool, setColumnNamesToFirstRow bool) error
LoadFromCSV(filePath string, setFirstColumnToRowNames bool, setFirstRowToColumnNames bool) error
// contains filtered or unexported methods
}
type LogLevel ¶
type LogLevel int
const ( // LogLevelDebug is the log level for debug messages. LogLevelDebug LogLevel = iota // LogLevelInfo is the log level for info messages. LogLevelInfo // LogLevelWarning is the log level for warning messages. LogLevelWarning // LogLevelFatal is the log level for fatal messages. LogLevelFatal )
type NameManager ¶
type NameManager struct {
// contains filtered or unexported fields
}