Documentation
¶
Index ¶
- func ContainsMissingValues(values []string, missingIndicators []string) bool
- func CountMissingValues(values []string, missingIndicators []string) int
- func DefaultMissingValues() []string
- func IsMissingValue(value string, missingIndicators []string) bool
- func IsNumericString(value string, decimalSeparator rune) bool
- func ParseFloatSlice(values []string, decimalSeparator rune, missingIndicators []string) ([]float64, error)
- func ParseNumericValue(value string, decimalSeparator rune) (float64, error)
- func ParseNumericValueWithMissing(value string, decimalSeparator rune, missingIndicators []string) (float64, bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsMissingValues ¶
ContainsMissingValues checks if a slice of strings contains any missing values. Useful for quick validation of data rows or columns.
func CountMissingValues ¶
CountMissingValues returns the number of missing values in a slice of strings.
func DefaultMissingValues ¶
func DefaultMissingValues() []string
DefaultMissingValues returns the default set of missing value indicators. These are commonly used representations of missing data across different data sources and statistical software packages.
func IsMissingValue ¶
IsMissingValue checks if a string value represents missing data. It performs a case-insensitive comparison against the provided list of missing value indicators.
Parameters:
- value: The string value to check
- missingIndicators: List of strings that represent missing values
Returns true if the value (after trimming whitespace) matches any of the missing indicators (case-insensitive).
func IsNumericString ¶
IsNumericString checks if a string can be parsed as a number. This is useful for determining column types in CSV files.
func ParseFloatSlice ¶
func ParseFloatSlice(values []string, decimalSeparator rune, missingIndicators []string) ([]float64, error)
ParseFloatSlice parses a slice of strings into a slice of float64 values. Missing values are represented as NaN in the output.
func ParseNumericValue ¶
ParseNumericValue attempts to parse a string as a float64. It handles different decimal separators and special float values.
Parameters:
- value: The string value to parse
- decimalSeparator: The decimal separator character ('.' or ',')
Returns the parsed float64 and an error if parsing fails. Special cases handled:
- "inf", "+inf", "infinity" -> +Inf
- "-inf", "-infinity" -> -Inf
- Empty string returns an error
func ParseNumericValueWithMissing ¶
func ParseNumericValueWithMissing(value string, decimalSeparator rune, missingIndicators []string) (float64, bool, error)
ParseNumericValueWithMissing combines numeric parsing with missing value detection. If the value is identified as missing, it returns NaN without an error.
Parameters:
- value: The string value to parse
- decimalSeparator: The decimal separator character
- missingIndicators: List of strings that represent missing values
Returns:
- float64: The parsed value (NaN if missing)
- bool: true if the value was identified as missing
- error: parsing error if the value is not missing and cannot be parsed
Types ¶
This section is empty.