Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

function for detecting outliers in python

def detect_outliers(df, columns):
    outlier_indices = []
    
    for c in columns:
        # 1st quartile
        q1 = np.percentile(df[c], 25)
        
        # 3rd quqartile
        q3 = np.percentile(df[c], 75)
        
…        outlier_indices.extend(outlier_list_col)
        
    outlier_indices = Counter(outlier_indices)
    multiple_outlier = list(i for i,v in outlier_indices.items() if v > 2)
    
    return multiple_outlier
Source by colab.research.google.com #
 
PREVIOUS NEXT
Tagged: #function #detecting #outliers #python
ADD COMMENT
Topic
Name
5+3 =