merge_machine/missing_values.py
def mv_from_letter_repetition(top_values, score=0.7):
    """Checks for unusual repetition of characters as in XX or 999999"""
    # Compute number of unique characters for each value
    num_unique_chars = pd.Series([len(set(list(x))) for x in top_values.index], index=top_values.index)
    # Check that we have at least 3 distinct values
    if len(num_unique_chars) >= 3:
        # Keep as NaN candidate if value has only 1 unique character and 
        # at least two characters and other values have at least two disctinct
        # characters
        num_unique_chars.sort_values(inplace=True)
        if (len(num_unique_chars.index[0]) > 1) \
                and (num_unique_chars.iloc[0] == 1) \
                and (num_unique_chars.iloc[1] >= 2):
            return [(num_unique_chars.index[0], score, 'letter_repeted')]
    return []
Checks for unusual repetition of characters as in XX or 999999
Checks for unusual repetition of characters as in XX or 999999
Checks for unusual repetition of characters as in XX or 999999
def mv_from_letter_repetition(top_values, score=0.7):
    num_unique_chars = pd.Series([len(set(list(x))) for x in top_values.index], index=top_values.index)
    if len(num_unique_chars) >= 3:
        num_unique_chars.sort_values(inplace=True)
        if (len(num_unique_chars.index[0]) > 1) \
                and (num_unique_chars.iloc[0] == 1) \
                and (num_unique_chars.iloc[1] >= 2):
            return [(num_unique_chars.index[0], score, 'letter_repeted')]
    return []
def mv_from_letter_repetition ( top_values , score = 0.7 ) : num_unique_chars = pd . Series ( [ len ( set ( list ( x ) ) ) for x in top_values . index ] , index = top_values . index ) if len ( num_unique_chars ) >= 3 : num_unique_chars . sort_values ( inplace = True ) if ( len ( num_unique_chars . index [ 0 ] ) > 1 ) and ( num_unique_chars . iloc [ 0 ] == 1 ) and ( num_unique_chars . iloc [ 1 ] >= 2 ) : return [ ( num_unique_chars . index [ 0 ] , score , 'letter_repeted' ) ] return [ ]
Checks for unusual repetition of characters as in XX or 999999
Checks for unusual repetition of characters as in XX or 999999
"""Checks for unusual repetition of characters as in XX or 999999""" # Compute number of unique characters for each value # Check that we have at least 3 distinct values # Keep as NaN candidate if value has only 1 unique character and  # at least two characters and other values have at least two disctinct # characters
top_values
score