Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def remove_outliers(df, column):
- q1 = df[column].quantile(0.25)
- q3 = df[column].quantile(0.75)
- iqr = q3 - q1
- lower_bound = round((q1 - 1.5*iqr), 2)
- upper_bound = round((q3 + 1.5*iqr), 2)
- return print(f'Межквартильный размах {column}: min {lower_bound} max {upper_bound}')
- list_column = ['total_area',
- 'rooms',
- 'living_area',
- 'last_price',
- 'kitchen_area',
- 'ceiling_height',
- 'floors_total',
- 'city_centers_nearest',
- 'ponds_nearest']
- for col in list_column:
- df[col] = remove_outliers(df, col)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement