1 min readMay 15, 2019
Hello Prithiv,
I compiled the code in one block.
I tried this and it worked. Please ensure you are using Python 3 or above
import numpy as np
import pandas as pddataset= [10,12,12,13,12,11,14,13,15,10,10,10,100,12,14,13, 12,10, 10,11,12,15,12,13,12,11,14,13,15,10,15,12,10,14,13,15,10]import numpy as np
import pandas as pd
outliers=[]
def detect_outlier(data_1):
threshold=3
mean_1 = np.mean(data_1)
std_1 =np.std(data_1)
for y in data_1:
z_score= (y - mean_1)/std_1
if np.abs(z_score) > threshold:
outliers.append(y)
return outliersoutlier_datapoints = detect_outlier(dataset)
print(outlier_datapoints)