Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- data = [1,2,5,6,3,1,1,7,2,2,2,3,1,1,2,8,10,50]
- fig = plt.figure(figsize =(5,5))
- ax = fig.add_axes([0,0,1,1])
- bp = ax.boxplot(data)
- plt.show()
- mean = np.mean(data)
- std = np.std(data)
- print("Mean: ", mean)
- print("Standard Deviation: ", std)
- threshold = 3
- outlier = []
- for i in data:
- z = (i-mean)/std
- if z > threshold:
- outlier.append(i)
- print(outlier)
Advertisement
Add Comment
Please, Sign In to add comment