AtulyaManikandan

Experiment No 4-0

Mar 26th, 2025
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. data = [1,2,5,6,3,1,1,7,2,2,2,3,1,1,2,8,10,50]
  4. fig = plt.figure(figsize =(5,5))
  5. ax = fig.add_axes([0,0,1,1])
  6. bp = ax.boxplot(data)
  7. plt.show()
  8. mean = np.mean(data)
  9. std = np.std(data)
  10. print("Mean: ", mean)
  11. print("Standard Deviation: ", std)
  12. threshold = 3
  13. outlier = []
  14. for i in data:
  15. z = (i-mean)/std
  16. if z > threshold:
  17. outlier.append(i)
  18. print(outlier)
Advertisement
Add Comment
Please, Sign In to add comment