import numpy as np from scipy import stats a = np.array([1,1,1,1,1,1,1,1,1,100]) a_no_outliers = a[(np.abs(stats.zscore(a)) < 3)] print(a_no_outliers) out: array([1, 1, 1, 1, 1, 1, 1, 1, 1])