VerityPy 1.1
Python library for Verity data profiling, quality control, remediation
Functions
VerityPy.processing.numfuncs Namespace Reference

Functions

bool is_int (str valnum)
 
bool is_real (str valnum)
 
 is_int_get (str valnum, str typ="", bool remove_front_chars=False)
 
 is_real_get (str valnum, str typ="", bool remove_front_chars=False)
 
str convert_mainframe (str valnum)
 
str get_value_from_suspect_exp (str valnum)
 
str clean_number (str valnum)
 

Detailed Description

Number Functions

various worker functions to manipulate numbers

Function Documentation

◆ clean_number()

str clean_number ( str valnum)
Cleans non-numeric prefix and suffix characters from number. 
    Enclosing parens which is interpreted as negative indicator and replaced with -, 
while leading + is removed.
returns string starting with notok: if error

Definition at line 534 of file numfuncs.py.

◆ convert_mainframe()

str convert_mainframe ( str valnum)
Convert MainFrame formatted number string

Converts a string representing a main frame formatted number with an encoded last character into a string of a 
real along with sign reversal if necessary 
Always makes last 2 digits into decimal portion so no further divide by 100 is necessary. If special char is 
within input string it becomes the end char and the 
remaining suffix is discarded. Leading zeros are truncated so 000.12 becomes 0.12 . Codes are:
{= 0
}= 0 and negate
a= 1
j= 1 and negate
b= 2
k= 2 and negate
c= 3
l= 3 and negate
d= 4
m= 4 and negate
e= 5
n= 5 and negate
f= 6
o= 6 and negate
g= 7
p= 7 and negate
h= 8
q= 8 and negate
i= 9
r= 9 and negate
Return result or starts with 'notok:' if error. If no special char found then original string returned

Definition at line 271 of file numfuncs.py.

◆ get_value_from_suspect_exp()

str get_value_from_suspect_exp ( str valnum)
Get Value From Suspected Exponential

Check string to see if it is an exponential number 
which is extracted into real number if so
Returns string of number if converted or original string. Starts with notok: if error

Definition at line 456 of file numfuncs.py.

◆ is_int()

bool is_int ( str valnum)
Checks if string is integer number. Returns bool

Definition at line 23 of file numfuncs.py.

◆ is_int_get()

is_int_get ( str valnum,
str typ = "",
bool remove_front_chars = False )
Checks if string is integer number. 

valnum: input string to check
typ: optional return type (string, number, bool)
remove_front_chars: optional. bool whether non-numeric chars as prefix will be removed
    and therefore not declare non-numeric
Return depends on typ. Default is bool. 
    number: converted integer or -999999 if error
    string: string of integer or false:reason if not. Reason will 
        be detected issue such as decimal (has decimal point),
        empty, non-numeric

Definition at line 45 of file numfuncs.py.

◆ is_real()

bool is_real ( str valnum)
Checks if string is real number. Returns bool

Definition at line 34 of file numfuncs.py.

◆ is_real_get()

is_real_get ( str valnum,
str typ = "",
bool remove_front_chars = False )
Checks if string is real number. 

valnum: input string to check
typ: optional return type (string, number, bool)
remove_front_chars: optional. bool whether non-numeric chars as prefix will be removed
    and therefore not declare non-numeric
Return depends on typ. Default is bool. 
    number: converted real or -999999 if error
    string: string of real or false:reason if not. Reason will 
        be detected issue such as empty, non-numeric

Definition at line 158 of file numfuncs.py.