Imputation

Imputation replaces missing values with an estimated value: mean or median for a numeric variable, mode for a category, previous value for a series, or a model. It keeps the rows but can bias the results, hence the need for a justified and documented method.

Example

df["age"] = df["age"].fillna(df["age"].median())

Related concepts

The whole glossary