Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Python :: xml to json in python 
Python :: scatter matrix plot 
Python :: jupyter dark theme vampire 
Python :: python numpy matrix to list 
Python :: numpy savetext 
Python :: python string contains 
Python :: python replace null in list 
Python :: tensor.numpy() pytorch gpu 
Python :: Access item in a list of lists 
Python :: python combine two lists into matrix 
Python :: string slices 
Python :: combination without repetition python 
Python :: python get current date 
Python :: torch flatten 
Python :: pandas dataframe.to_dict 
Python :: flatten list python 
Python :: draw box with mouse on image in canvas tkinter 
Python :: how to take float input upto 2 decimal points in python 
Python :: python imaplib send email 
Python :: how to create dictionary in python from csv 
Python :: Flatten List in Python Using NumPy Flatten 
Python :: method for detect that a float number is integer in python 
Python :: datetime.time to seconds 
Python :: drop first column read_csv 
Python :: Video to text convertor in python 
Python :: django request user 
Python :: remove rows from pandas 
Python :: how to get a int from string python 
Python :: np sum 
Python :: transform data frame in list 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =