Pandas Penghapusan Pencilan
df = pd.DataFrame(np.random.randn(100, 3))
from scipy import stats
df[(np.abs(stats.zscore(df)) < 3).all(axis=1)]
Frantic Fox
df = pd.DataFrame(np.random.randn(100, 3))
from scipy import stats
df[(np.abs(stats.zscore(df)) < 3).all(axis=1)]
q1 = df['column'].quantile(0.25)
q3 = df['column'].quantile(0.75)
iqr = q3 - q1
df.loc[df['column'] > (q3 + 1.5 * iqr) | df['column'] < (q1 - 1.5 * iqr), 'column'] = df['column'].mean()
#Removing outliers first then skewness
from scipy.stats import zscore
z=abs(zscore(df))
print(z.shape)
df=df[(z<3).all(axis=1)]
df.shape