Skip to main content

encode_optional_categorical_column

Function encode_optional_categorical_column 

Source
pub fn encode_optional_categorical_column(
    name: &str,
    column: &[Option<&str>],
) -> Result<(SchemaColumn, Vec<f64>), DataError>
Expand description

Encode a dtype-declared categorical column while preserving missing cells.

Generic table ingestion happens before a formula or fitted-model schema is available, so it cannot decide whether a missing cell belongs to a column the model will consume. Missing categorical cells therefore travel in the same representation as missing numeric cells (NaN) and are rejected only after the caller projects to the model’s actual input contract. Present labels retain the canonical natural ordering used by every other ingestion path.