SyntaxFix
Write A Post
Hire A Developer
Questions
This method is almost identical to yours, just more numpyst (also working on numpy arrays only):
def reject_outliers(data, m=2): return data[abs(data - np.mean(data)) < m * np.std(data)]