Problem with categorical missing values

Hi there friends,
During my work on this assignment, after encoding the categorical data the fitting is giving me an error as “ValueError: Input contains NaN”. after checking the workflow, I realized that the imputation of categorical columns was not covered. Should we dot it here to solve this issue? is anyone who came across the same problem… need some hint.

Thanks

1 Like

The categorical features contain NaN values , so you need to fill them with the string ‘unknown’, that way the model ignore them:

inputs_df[categorical_cols]= inputs_df[categorical_cols].fillna(‘unknown’)

thanks! good luck bro !

thank you very much @samir-kouider it helped me.