Is there a way to impute categorical values using a sklearn.preprocessing object? I would like to ultimatly create a preprocessing object which I can apply to new data and have it transformed the same way as old data.
I am looking for a way to do it so that I can use it this way.
Yes, it is possible. For example, you can use sklearn.preprocessing.Imputer
with parameter strategy = 'most_frequent'
.
Use fit_transform
method to apply it to old data (train set) and then transform
on new data (test set).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With