Handle Missing Values By Type
List the columns with missing data — name, type, approximate percent missing, and likely cause — and this prompt classifies each one as MCAR, MAR, or MNAR before recommending a fix. It weighs whether the missingness itself is informative, considers adding a was_missing flag, justifies the chosen imputation method against alternatives for every column, and outputs the Python code implementing the strategy column by column.
My dataset has missing values in the following columns:
{missing_columns}
For every column, recommend and implement the most suitable missing-data approach:
- MCAR (Missing Completely at Random) → which method?
- MAR (Missing at Random) → which method?
- MNAR (Missing Not at Random) → which method?
Think through:
- Does the missingness itself carry information?
- Could imputation bias later analysis?
- Is a "was_missing" flag column worth adding?
- Justify each chosen imputation method against the alternatives
Provide the Python code implementing your chosen approach column by column.