Skip to content

Instantly share code, notes, and snippets.

@stefanondisponibile
Created February 19, 2019 16:57
Show Gist options
  • Save stefanondisponibile/1e8457ec856c2034c92c27a6fbeea09d to your computer and use it in GitHub Desktop.
Save stefanondisponibile/1e8457ec856c2034c92c27a6fbeea09d to your computer and use it in GitHub Desktop.
Drops outliers from a dataframe with zscore
import pandas as pd
from scipy import stats
# df = .....
df = df[(np.abs(stats.zscore(df[feature_cols])) < 3).all(axis=1)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment