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 pd
dataset= [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 outliers
outlier_datapoints = detect_outlier(dataset)
print(outlier_datapoints)

Loves learning, sharing, and discovering myself. Passionate about Machine Learning and Deep Learning

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store