feature-engineering-and-data-transformations/using-toy-exmaples/feature_cleaning/outlier.py
def outlier_detect_arbitrary(data,col,upper_fence,lower_fence):
    '''
    identify outliers based on arbitrary boundaries passed to the function.
    '''

    para = (upper_fence, lower_fence)
    tmp = pd.concat([data[col]>upper_fence,data[col]<lower_fence],axis=1)
    outlier_index = tmp.any(axis=1)
    print('Num of outlier detected:',outlier_index.value_counts()[1])
    print('Proportion of outlier detected',outlier_index.value_counts()[1]/len(outlier_index))    
    return outlier_index, para

    identify outliers based on arbitrary boundaries passed to the function.
    
identify outliers based on arbitrary boundaries passed to the function.
identify outliers based on arbitrary boundaries passed to the function .
def outlier_detect_arbitrary(data,col,upper_fence,lower_fence):
    para = (upper_fence, lower_fence)
    tmp = pd.concat([data[col]>upper_fence,data[col]<lower_fence],axis=1)
    outlier_index = tmp.any(axis=1)
    print('Num of outlier detected:',outlier_index.value_counts()[1])
    print('Proportion of outlier detected',outlier_index.value_counts()[1]/len(outlier_index))    
    return outlier_index, para
def outlier_detect_arbitrary ( data , col , upper_fence , lower_fence ) : para = ( upper_fence , lower_fence ) tmp = pd . concat ( [ data [ col ] > upper_fence , data [ col ] < lower_fence ] , axis = 1 ) outlier_index = tmp . any ( axis = 1 ) print ( 'Num of outlier detected:' , outlier_index . value_counts ( ) [ 1 ] ) print ( 'Proportion of outlier detected' , outlier_index . value_counts ( ) [ 1 ] / len ( outlier_index ) ) return outlier_index , para
identify outliers based on arbitrary boundaries passed to the function.
identify outliers based on arbitrary boundaries passed to the function .
'''
    identify outliers based on arbitrary boundaries passed to the function.
    '''
data
col
upper_fence
lower_fence