numeric_edahelper.flag_outliers
Module Contents
Functions
|
Takes a dataframe and returns numeric variables (column names) containing outliers exceeding |
- numeric_edahelper.flag_outliers.flag_outliers(df, threshold=0.2)[source]
Takes a dataframe and returns numeric variables (column names) containing outliers exceeding user-specified threshold, as well as their respective percentage of outliers as defind by IQR
- Parameters
df (pandas.DataFrame) – dataset used for EDA analysis
threshold (float (optional)) – minimum percentage threshold for the proportion of outliers, above which will have variables flagged
- Returns
a dictionary containing the name of variables with high outliers and its respective percentage of outliers
- Return type
dict
Examples
>>> import pandas as pd >>> df = pd.DataFrame({'col1': [-100,-200, 1,2,3,4,5,6,7,8,9,10, 1000], 'col2': [1,2,3,4,5,6,7,8,9,10,11,12,13], 'col3': [-50, 1,2,3,4,5,6,7,8,9,10,11,50000]}) >>> flag_outliers(df, threshold=0.2) {'col1': 0.23076923076923078}