Skip to main content
Module 6 · Lesson 1 of 527/56 in the course~20 min
Module lessons (1/5)

Missing values

Lesson preview5 hands-on exercises readyMachine Learning: from first principles to practice · Module 6 — Data preparation and pipelines

Find, impute or flag missing data without leaking test information.

What you'll learn in this lesson

  • Find and count missing values in a table.
  • Fill them with SimpleImputer and choose between mean, median and most frequent.
  • Impute inside a pipeline so no information leaks from the test data.

Overview

Sensors fail, people skip form fields, joins miss rows. Most scikit-learn models refuse to run when a value is missing (NaN), so you must decide what to do. There is no free lunch:

Three incomes are missing and one is extreme. Switch strategies and watch the typical value.

Sections covered in this lesson

  1. 1The hook: real data has holes
  2. 2Try it: what does each strategy do?
  3. 3Choosing a missing-value strategy
  4. 4Progressive examples: inspecting and imputing safely
  5. 5Practice
  6. 6Check your understanding
Pro Lesson · Module 6 — Data preparation and pipelines

Unlock "Missing values" and the full Machine Learning: from first principles to practice curriculum

Find, impute or flag missing data without leaking test information.

Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.

  • Instant access to all advanced modules in Machine Learning: from first principles to practice plus 17 more courses
  • Hands-on browser exercises with automated test suites and solutions
  • 14-day money-back guarantee processed via Paddle.com

14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.