text_html_output_1.png
def outlier_removal(dataframe, features):
    for feature_name in features:
        Q1 = dataframe[feature_name].quantile(0.25)
        Q3 = dataframe[feature_name].quantile(0.75)
        IQR = Q3 - Q1
        dataframe = dataframe[(dataframe[feature_name] >= Q1 - 1.5 * IQR) & (dataframe[feature_name] <= Q3 + 1.5 * IQR)]
    return dataframe