Python
All Top Python Interview Questions#45
Detect Outliers Using Interquartile Range (IQR) in Pandas
MediumGoogleInterview Question #45
Asked at GoogleWrite a function that calculates the Interquartile Range (IQR) of a numeric column and returns all rows flagged as statistical outliers.
Input Table: amounts
8 rows preview| amount |
|---|
| 10 |
| 12 |
| 14 |
| 15 |
| 16 |
| 18 |
| 20 |
| 150 |
Expected Output Structure1 rows
| outlier_amount |
|---|
| 150 |
Interview Context
Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.
Python 3.10 (Pandas)
Environment Ready
Starting the real Python + pandas runtime (one-time download)…