๋ฐ์ํ
def dr_outlier(df):
quartile_1 = df.quantile(0.25)
quartile_3 = df.quantile(0.75)
IQR = quartile_3 - quartile_1
condition = (df < (quartile_1 - 1.5 * IQR)) | (df > (quartile_3 + 1.5 * IQR))
condition = condition.any(axis=1)
search_df = df[condition]
return search_df, df.drop(search_df.index, axis=0)
<์ฐธ๊ณ >
https://en.wikipedia.org/wiki/Interquartile_range
๋ฐ์ํ
'Python > Pandas' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Python] Pandas - Dataframe ํจ์ ๋ชจ์ (0) | 2021.07.26 |
---|---|
[Python] Pandas - Dataframe for ๋ฌธ ์กฐํ (0) | 2021.02.16 |
[Python] Pandas - DataFrame ํน์ ์ด ์ ํ (0) | 2020.12.18 |
[Python] Pandas - DataFrame ์ธ๋ฑ์ค reset ํ๊ธฐ (0) | 2020.12.18 |
[Python] Pandas - Dataframe ๋ฆฌ์คํธ ์ด์ฉํ ํํฐ : isin ์ฌ์ฉ (0) | 2020.12.16 |