Renu Khandelwal
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 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)

--

--

Renu Khandelwal
Renu Khandelwal

Written by Renu Khandelwal

A Technology Enthusiast who constantly seeks out new challenges by exploring cutting-edge technologies to make the world a better place!

Responses (1)