Login using Social Account
     Continue with GoogleLogin using your credentials
This method is similar to IQR method. If any value exceeds the value of the 99th percentile or is below the 1st percentile then they are treated as outliers.
First, we will import Numpy
as np
import numpy as <<your code goes here>>
Then, we will use the same datapoints we used ealier
x = [5, 5, 5, -99, 5, 5, 5, 5, 5, 5, 88, 5, 5, 5]
Now, we will define a function winsorization_outliers
to detect the outliers
def <<your code goes here>>(data):
outlier=[]
q1 = np.percentile(data, 1)
q3 = np.percentile(data, 99)
for i in data:
if i > q3 or i < q1:
outlier.append(i)
print("Outliers:",outlier)
Finally, we will call this function using our datapoints
winsorization_outliers(<<your code goes here>>)
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
No hints are availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...