Documentation
¶
Overview ¶
Package values is an internal package that powers the values within pd/Series and pd/DataFrame. This package defines the Values interface and multiple concrete implementations of the interface.
Index ¶
- func GetDisplayColumnsWhitespaceBuffer() int
- func GetDisplayElementWhitespaceBuffer() int
- func GetDisplayIndexWhitespaceBuffer() int
- func GetDisplayValuesWhitespaceBuffer() int
- func GetInterpolationMaximum() int
- func GetInterpolationThreshold() float64
- func GetMultiColNameSeparator() string
- func Interpolate(data interface{}) options.DataType
- func InterpolateString(s string) interface{}
- func MakeIntRange(min, max int) []int
- func MakeIntRangeInclusive(start, end int) []int
- func MakeNullRange(n int) []interface{}
- func MakeStringRange(min, max int) []string
- func MapSplitter(data []interface{}) (isSplit bool, extractedData []interface{}, extractedColumns []string)
- func TransposeValues(data [][]interface{}) []interface{}
- type Container
- func InterfaceFactory(data interface{}) (Container, error)
- func InterfaceSliceFactory(data []interface{}, manualMode bool, dataType options.DataType) ([]Container, error)
- func MustCreateValuesFromInterface(data interface{}) Container
- func ScalarFactory(data interface{}) (Container, error)
- func SliceFactory(data interface{}) (Container, error)
- type Elem
- type Values
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDisplayColumnsWhitespaceBuffer ¶
func GetDisplayColumnsWhitespaceBuffer() int
GetDisplayColumnsWhitespaceBuffer returns displayColumnsWhitespaceBuffer. displayColumnsWhitespaceBuffer is an option when printing a Series or DataFrame. It is the number of spaces between columns in a DataFrame.
Default buffer: 2 spaces
func GetDisplayElementWhitespaceBuffer ¶
func GetDisplayElementWhitespaceBuffer() int
GetDisplayElementWhitespaceBuffer returns displayElementWhitespaceBuffer. DisplayElementWhitespaceBuffer is an option when printing an Element. It is the number of spaces between the last level of index labels and the first value.
// Default buffer: 1 space
func GetDisplayIndexWhitespaceBuffer ¶
func GetDisplayIndexWhitespaceBuffer() int
GetDisplayIndexWhitespaceBuffer returns displayIndexWhitespaceBuffer. DisplayIndexWhitespaceBuffer is an option when printing a Series. It is the number of spaces between index labels. This applies only to a multi-level index.
Default buffer: 1 space
func GetDisplayValuesWhitespaceBuffer ¶
func GetDisplayValuesWhitespaceBuffer() int
GetDisplayValuesWhitespaceBuffer returns displayValuesWhitespaceBuffer. displayValuesWhitespaceBuffer is an option when printing a Series or DataFrame. It is the number of spaces between the last level of index labels and the first collection of values. In a Series, there is only one collection of values. In a DataFrame, the first collection of values is the first Series.
Default buffer: 4 spaces
func GetInterpolationMaximum ¶
func GetInterpolationMaximum() int
GetInterpolationMaximum returns the max number of records that will be checked during an interpolation check.
Default: 50
func GetInterpolationThreshold ¶
func GetInterpolationThreshold() float64
GetInterpolationThreshold returns the ratio of type inclusion required for a dataType to be interpolated.
Default: .80
func GetMultiColNameSeparator ¶
func GetMultiColNameSeparator() string
GetMultiColNameSeparator returns the multiColNameSeparator. The multiColNameSeparator separates col names whenever a multicol is concatenated together (e.g., into a Series name or index level name).
Default: " | "
func Interpolate ¶
Interpolate counts the number of instances of each dataType option within data, which must be []interface. If any ratio exceeeds the Interpoliation Threshold ratio, returns the dataType with the highest ratio.
func InterpolateString ¶
func InterpolateString(s string) interface{}
InterpolateString converts a string into another datatype if possible, or retains as string otherwise, then creates a Container from the new datatype. Primary use is translating column data into index data or reading from [][]string.
func MakeIntRange ¶
MakeIntRange returns a sequential series of numbers, for use in making default index labels. Includes min and excludes max.
func MakeIntRangeInclusive ¶
MakeIntRangeInclusive returns a sequential series of numbers, for use in making default index labels. Includes start and end.
func MakeNullRange ¶
func MakeNullRange(n int) []interface{}
MakeNullRange returns a sequential series of null values, for use in stacking and unstacking columns. Includes min and excludes max.
func MakeStringRange ¶
MakeStringRange returns a sequential series of numbers as string values, for use in making default column labels.
func MapSplitter ¶
func MapSplitter(data []interface{}) (isSplit bool, extractedData []interface{}, extractedColumns []string)
MapSplitter splits map[string]interface{} into []interface (for use in dataframe constructor) and []string (for use in Column config)
func TransposeValues ¶
func TransposeValues(data [][]interface{}) []interface{}
TransposeValues pivots [][]interface{}{row1{col1, col2, col3}} to []interface{}{col1{row1}, col2{row1}, col3{row1}}
Types ¶
type Container ¶
Container contains Values (a list of Value/Null pairs satisfying the Values interface) and Kind.
func InterfaceFactory ¶
InterfaceFactory converts interface{} to Container
func InterfaceSliceFactory ¶
func InterfaceSliceFactory(data []interface{}, manualMode bool, dataType options.DataType) ([]Container, error)
InterfaceSliceFactory converts []interface{} to []Container. If manualMode is true, []interface{} columns will not be interpolated.
func MustCreateValuesFromInterface ¶
func MustCreateValuesFromInterface(data interface{}) Container
MustCreateValuesFromInterface returns a container that satisfies the Values interface or panics.
func ScalarFactory ¶
ScalarFactory creates a Container from an interface{} that has been determined elsewhere to be a scalar. Be careful modifying this constructor and its children, as reflection is inherently unsafe and each function expects to receive specific types only.
func SliceFactory ¶
SliceFactory creates a Container from an interface{} that has been determined elsewhere to be a Slice. Be careful modifying this constructor and its children, as reflection is inherently unsafe and each function expects to receive specific types only.
type Values ¶
type Values interface {
Len() int // number of Value/Null structs
Vals() interface{} // an interface of values, ready for type assertion into a slice of their native type
Values() []interface{} // an interface slice of values, for handling values as a predictable slice
Subset([]int) Values // a new Values object comprised of the Value/Null pairs at one or more integer positions
Element(int) Elem // Value/Null pair at an integer position
Value(int) interface{} // the value field at an integer position
Null(int) bool // the null field at an integer position
Set(int, interface{}) // overwrite the value/null struct at an integer position
Copy() Values // clone the Values
Insert(int, interface{}) // insert a Value/Null pair at an integer position
Append(Values) // append Values together
Drop(int) // drop a Value/Null pair at an integer position
Swap(i, j int) // swap two values - necessary for sorting
Less(i, j int) bool // compare two values and return the lesser - required for sorting
ToFloat64() Values
ToInt64() Values
ToString() Values
ToBool() Values
ToDateTime() Values
ToInterface() Values
}
The Values interface is the primary means of handling a collection of values. The same interface and value types are used for both Series values and Index labels