'OrdinalEncoder' object has no attribute 'get_feature_names_out'

I’ve obtained the following error in section [14: ] of the jupyter notebook Encoding Categorical Variable

The code in the NOtebook is the folowing:
feature_names = encoder.get_feature_names_out(input_features=[“education”])
education_encoded = pd.DataFrame(education_encoded, columns=feature_names)
education_encoded

Thank you in advance

In the exercise, I think that we only run the get_feature_names_out with the OneHotEncoder. Indeed, it is not yet available for the OrdinalEncoder and will only be available from the next version of scikit-learn (i.e. 1.1).

Be sure to have run the cell that define the encoder = OneHotEncoder().

1 Like