pycognaize.common.numeric_parser.NumericParser
- class NumericParser(raw)[source]
Bases:
object
Parser for any kind of text input into a corresponding format. Numeric data is assumed to be valid and clean. Use NumericColumnFormatter for validating your data.
- Parameters:
raw (
str
)
Methods
Infer the sign of the number either with brackets or a trailing minus sign
Determines if the text is a representation of a numeric value
Parse the raw data, and return parsed numeric value and get the numeric, separator and value type of the raw data
Used for parsing raw text without getting any context from the column
Parse Like a regular float number
Parse Like a regular float number with semicolon
remove_dash_sign
remove_sign_parentheses
Strip non-numeric characters from a string representing a number :param str text: Input string representing a number :return: String with stripped non-numeric characters :rtype str:
Attributes
REGEX_NO_ALPHANUM_CHARS
brackets
delimiters
numeric
single_white_space_regex
- is_numeric()[source]
Determines if the text is a representation of a numeric value
- Return type:
bool
- Returns:
True if the raw text corresponds to numeric representation
- parse_numeric()[source]
Parse the raw data, and return parsed numeric value and get the numeric, separator and value type of the raw data
- Return type:
Union
[int
,float
]- Returns:
Parsed float or int value