Created
February 1, 2021 16:32
-
-
Save letthedataconfess/80ced9483c3485b623fa0e8cb1d00ecd to your computer and use it in GitHub Desktop.
outlier_detection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dataset=[11,10,12,14,12,15,14,13,15,102,12,14,17,19,107,10,13,12,14,12,108,12,11,14,13,15,10,15,12,10,14,13,15,10] | |
dataset=sorted(dataset) | |
q1, q3= np.percentile(dataset,[25,75]) | |
iqr = q3 - q1 | |
lower_bound = q1 -(1.5 * iqr) | |
upper_bound = q3 +(1.5 * iqr) | |
print('lower_bound={},upper_bound={}'.format(lower_bound,upper_bound)) | |
outliers_pt=[] | |
for x in dataset: | |
if x<lower_bound or x>upper_bound: | |
outliers_pt.append(x) | |
outliers_pt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment