An indicator variable is a binary feature that records whether a condition holds. For missing data, it preserves the information that a value was absent, which may itself predict the outcome. section 2.4.2
Use indicator variables when exploring and preparing tabular features:
- Check missingness with .isna() and count True values, where True behaves as 1 and False as 0. section 2.4.2
- Create missingness indicators for features with substantial missing data when the missing pattern may carry predictive information. section 2.4.2
- Handle the missing values themselves separately; models such as deep learning solutions still require numeric imputation. section 2.4.2
Auto MPG missingness check
The Auto MPG data contains 8 missing mpg values and 6 missing horsepower values. These counts identify candidate features for missingness indicators, while the original missing values still need an appropriate treatment. section 2.4.2
(data.isna()
.sum(axis=0)
)
Inspect the column-level missing-value counts that guide indicator-variable decisions. section 2.4.2



