1. Learn
  2. /
  3. Courses
  4. /
  5. Anomaly Detection in Python

Exercise

Calculating outlier limits with IQR

Visualizing outliers is usually only the first step in detecting outliers. To go beyond visualizing outliers, you will need to write code that isolates the outliers from the distribution.

In this exercise, you will implement the first step of what's going on under the hood of the boxplot. In other words, you will calculate the lower and upper outlier limits manually.

The distribution is available as prices.

Instructions

100 XP
  • Calculate the first and third quartiles of prices and store these as q1 and q3, respectively.
  • Calculate the IQR score into IQR.
  • Calculate the lower outlier limit into lower_limit.
  • Calculate the upper outlier limit into upper_limit.