Missing Data & Transformations
Finding and filling gaps, plus the vectorized way to change values.
| Call | Behavior | Example |
|---|---|---|
| drop rows with ANY missing value | a 3-row df with 1 NaN row → 2 rows left |
| keep rows with at least 2 non-missing values | row with only 1 non-null value gets dropped, others kept |
| fill every gap with a constant |
|
| fill gaps by linear interpolation |
|
For transforming values, vectorized operations beat .apply() almost
every time: .apply() runs a real Python function call per row/element, which
is much slower than an operation NumPy/pandas can run in a tight C loop.
Now practice it
Exercises that use what this lesson just covered.