merge_machine/missing_values.py
def mv_from_not_digit(top_values, score=1):
    """Check if one value is the only not digit (and is only text)"""
    is_digit = pd.Series([x.replace(',', '').replace('.', '').isdigit() 
                        for x in top_values.index], index=top_values.index)
    if len(top_values) >= 3:
        if (~is_digit).sum() == 1:
            mv_value = is_digit[is_digit == False].index[0]
            if mv_value.isalpha():
                return [(mv_value, score/2. + score/2.*(len(top_values) >= 4), 
                         'not_digit')]
    return []
Check if one value is the only not digit (and is only text)
Check if one value is the only not digit (and is only text)
Check if one value is the only not digit ( and is only text )
def mv_from_not_digit(top_values, score=1):
    is_digit = pd.Series([x.replace(',', '').replace('.', '').isdigit() 
                        for x in top_values.index], index=top_values.index)
    if len(top_values) >= 3:
        if (~is_digit).sum() == 1:
            mv_value = is_digit[is_digit == False].index[0]
            if mv_value.isalpha():
                return [(mv_value, score/2. + score/2.*(len(top_values) >= 4), 
                         'not_digit')]
    return []
def mv_from_not_digit ( top_values , score = 1 ) : is_digit = pd . Series ( [ x . replace ( ',' , '' ) . replace ( '.' , '' ) . isdigit ( ) for x in top_values . index ] , index = top_values . index ) if len ( top_values ) >= 3 : if ( ~ is_digit ) . sum ( ) == 1 : mv_value = is_digit [ is_digit == False ] . index [ 0 ] if mv_value . isalpha ( ) : return [ ( mv_value , score / 2. + score / 2. * ( len ( top_values ) >= 4 ) , 'not_digit' ) ] return [ ]
Check if one value is the only not digit (and is only text)
Check if one value is the only not digit ( and is only text )
"""Check if one value is the only not digit (and is only text)"""
top_values
score