Back to the lessonPreparing the printout…

Data Cleaning and Preprocessing with Python · Module 2 — Clean the Data

Period 10 · Detecting Outliers with the IQR

[video] Lecture video — Period 10: Detecting Outliers with the IQR — /api/lesson-media/videos/4d3653ff-a3ca-4f63-bf8e-bb93c553e599-1794847912150-462b9adc161f9140.mp4

[markdown] content available only on the platform

[markdown] content available only on the platform

Flashcards · Detecting Outliers with the IQR

Statistical outlier — A value far from most other values in a chosen reference group.

30 items when most orders are 2-9 items.

Data error — A value shown to be incorrect by reliable evidence or a business rule.

Invoice shows 3 items, data say 30.

IQR fences — Limits at Q1 - 1.5 x IQR and Q3 + 1.5 x IQR; values strictly outside are flagged.

Q1 4, Q3 8 gives fences -2 and 14.

Retain — Keeping a flagged value because the source confirms it is real, and documenting why it was flagged.

A confirmed wholesale order of 30 items.

Correct — Replacing a value only when reliable evidence gives the true value, while preserving the original.

`corrected.loc[8] = 3` with the invoice logged.

Capping — Limiting values to a chosen bound for analysis; it changes the data and is not a correction.

Set quantities above 14 to 14, and explain why.

Zero IQR — When Q1 equals Q3 the fences collapse, so many valid values may be flagged.

A small group where most quantities are 1.

Before-and-after summary — A table comparing key statistics before and after a treatment to show its effect.

Sum 74 to 47, mean 8.22 to 5.22.

Series.quantile() — Returns values at given percentiles, using linear interpolation by default.

`qty.quantile([0.25, 0.75])`

[pdf] Lecture slides — Period 10 (PDF) — /api/lesson-media/pdfs/4d3653ff-a3ca-4f63-bf8e-bb93c553e599-1794873722993-c67e316da8ceb755.pdf

[markdown] content available only on the platform

Data Cleaning and Preprocessing with Python · Period 10 · Detecting Outliers with the IQR · printed on November 20, 2026