Snippets Collections
def find_boundaries(df, variable, distance=1.5):

    IQR = df[variable].quantile(0.75) - df[variable].quantile(0.25)

    lower_boundary = df[variable].quantile(0.25) - (IQR * distance)
    upper_boundary = df[variable].quantile(0.75) + (IQR * distance)

    return upper_boundary, lower_boundary
star

Mon Sep 05 2022 09:55:05 GMT+0000 (Coordinated Universal Time)

#python #pandas #dataset #eda #outliers #boundaries

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension