The CategoricalImputer replaces all missing values with the most frequent value of the whole passed data frame. The desired behaviour is to replace each missing value with the most frequent value of the missing value's column.