Ordinal Encoder : got an unexpected keyword argument 'handle_unknown'

I am rerunning the Exercise M1.04 on my local notebook and found this error when making pipeline of Ordinal Encoder. Wondering what happens here

TypeError: init() got an unexpected keyword argument ‘handle_unknown’.

Update to the latest scikit-learn version (0.24.2). It was added in 0.24

1 Like

in notebook cell run:

!python -m pip install --user --upgrade scikit-learn

then restart notebook kernel and then check version:

import sklearn
print(sklearn.__version__)
> 0.24.2

I will not give such advice. This is much more complex since you can use your Python system, or pip, or conda. So upgrade scikit-learn depending on your environment and not blindly update in the notebook.