개요
- Python 이상치 탐지
import pandas as pd
df = pd.read_csv("https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv")
Q1 = df.quantile(0.25)['sepal_width']
Q3 = df.quantile(0.75)['sepal_width']
IQR = Q3 - Q1
df[(df['sepal_width']<Q1-1.5*IQR) | (df['sepal_width']>Q3+1.5*IQR)]