title: OneHotEncoder - encoding only some of categorical variable columns
body: <p>Let's assume that I have a pandas dataframe with the following column names:</p>
  
  <ul>
  <li><code>'age'</code> (e.g. 33, 26, 51 etc)</li>
  <li><code>'seniority'</code> (e.g. 'junior', 'senior' etc)</li>
  <li><code>'gender'</code> (e.g. 'male', 'female')</li>
  <li><code>'salary'</code> (e.g. 32000, 40000, 64000 etc)</li>
  </ul>
  
  <p>I want to transform the <code>seniority</code> categorical variables to one hot encoded values. For this reason I am doing the following:</p>
  
  <pre><code>from sklearn.preprocessing import LabelEncoder
  label_encoder = LabelEncoder()
  data['seniority'] = label_encoder.fit_transform(data['seniority'])
  
  from sklearn.preprocessing import OneHotEncoder
  one_hot_encoder = OneHotEncoder(categorical_features=[1])
  data = one_hot_encoder.fit_transform(data.values)
  </code></pre>
  
  <p>But then I am getting this error </p>
  
  <pre><code>ValueError: could not convert string to float: 'gender'
  </code></pre>
  
  <p>at line</p>
  
  <pre><code>data = one_hot_encoder.fit_transform(data.values)
  </code></pre>
  
  <p>However, I have explicitly specified that <code>categorical_features=[1]</code> so only column 1 (<code>seniority</code>) should be considered for this one hot encoding.</p>
  
  <p>How can I fix this error (except for example by dropping the column 'gender')?</p>
  
  <p>I was using <code>pandas.get_dummies</code> in the past and I did not have this problem.</p>