title: preprocessing error trying to use OneHot Encoder Python
body: <p>I'm trying to run the code below in virtual machine for a homework practice problem.  I'm getting the error message below, and I'm trying to figure out if it's an issue with my code or the site.  If anyone can point out if it's an error with my code an how to fix it I'd be grateful.  If my code looks ok, then I'll let the course know they have a bug.</p>
  
  <pre><code>Code:
  
  
  
  import numpy as np
  import pandas as pd
  
  # Load the dataset
  X = pd.read_csv('titanic_data.csv')
  # Limit to categorical data
  X = X.select_dtypes(include=[object])
  
  from sklearn.preprocessing import LabelEncoder
  from sklearn.preprocessing import OneHotEncoder
  
  # TODO: Create a LabelEncoder object, which will turn all labels present in
  #       in each feature to numbers.
  # HINT: Use LabelEncoder()
  
  df=pd.DataFrame(X)
  
  le = preprocessing.labelEncoder()
  
  
  # TODO: For each feature in X, apply the LabelEncoder's fit_transform
  #       function, which will first learn the labels for the feature (fit)
  #       and then change the labels to numbers (transform).
  
  df2=df.apply(le.fit_transform)
  
  
  #for feature in X:
      # HINT: use fit_transform on X[feature] using the LabelEncoder() object
      #X[feature] = label_encoder.fit_transform(X[feature])
  
  # TODO: Create a OneHotEncoder object, which will create a feature for each
  #       label present in the data.
  # HINT: Use OneHotEncoder()
  ohe = preprocessing.OneHotEncoder()
  
  # TODO: Apply the OneHotEncoder's fit_transform function to all of X, which will
  #       first learn of all the (now numerical) labels in the data (fit), and then
  #       change the data to one-hot encoded entries (transform).
  
  # HINT: Use fit_transform on X using the OneHotEncoder() object
  
  onehotlabels = enc.fit_transform(df2)
  
  
  Error:
  
  Traceback (most recent call last):
    File "vm_main.py", line 33, in &lt;module&gt;
      import main
    File "/tmp/vmuser_zrkfroofmi/main.py", line 2, in &lt;module&gt;
      import studentMain
    File "/tmp/vmuser_zrkfroofmi/studentMain.py", line 3, in &lt;module&gt;
      import OneHot
    File "/tmp/vmuser_zrkfroofmi/OneHot.py", line 21, in &lt;module&gt;
      le = preprocessing.labelEncoder()
  NameError: name 'preprocessing' is not defined
  </code></pre>