title: LabelEncoder does not seem to work correctly. How can I fix it?
body: <p><a href="https://i.stack.imgur.com/h43ku.png" rel="nofollow noreferrer">enter image description here</a>It all seems right to me but it doesn't work. The label has been converted to numbers but he sees it as not converted giving me this error message: <strong>ValueError: could not convert string to float: 'veryhigh'</strong>
  Some idea? I don't see where I'm wrong. Thank you!</p>
  <pre><code> import pandas as pd
   import numpy as np
  
   data = pd.read_csv('ohe_label_encoder.csv')
   data.head(3)
   X = data.drop('Class', axis = 1)
   y = data['Class']
  
  # I convert the Class label into numbers
  from sklearn.preprocessing import LabelEncoder
  label = LabelEncoder()
  data['Class'] = label.fit_transform(data['Class'])
  data[:1]
  
  # I convert the Color and Material features into numbers
  from sklearn.preprocessing import OneHotEncoder
  from sklearn.compose import ColumnTransformer
  
  categorical_features = ['Colour','Material']
  
  one_hot = OneHotEncoder()
  transformer = ColumnTransformer([('one_hot',
                                     one_hot, 
                                     categorical_features)], 
                                     remainder = 'passthrough')
  transformed_X = transformer.fit_transform(X)
  transformed_X.toarray()[:1]
  
  pd.DataFrame(transformed_X.toarray())[:1]
  
  # I train the net
  from sklearn.model_selection import train_test_split
  from sklearn.ensemble import RandomForestRegressor
  model = RandomForestRegressor()
  X_train, X_test, y_train, y_test = train_test_split(transformed_X, y, test_size = 0.2)
  
  model.fit(X_train, y_train)[enter image description here][1]
  </code></pre>