title: How to use the output from OneHotEncoder in sklearn?
body: <p>I have a Pandas Dataframe with 2 categorical variables, and ID variable and a target variable (for classification). I managed to convert the categorical values with <code>OneHotEncoder</code>. This results in a sparse matrix. </p>
  
  <pre><code>ohe = OneHotEncoder()
  # First I remapped the string values in the categorical variables to integers as OneHotEncoder needs integers as input
  ... remapping code ...
  
  ohe.fit(df[['col_a', 'col_b']])
  ohe.transform(df[['col_a', 'col_b']])
  </code></pre>
  
  <p>But I have no clue how I can use this sparse matrix in a DecisionTreeClassifier? Especially when I want to add some other non-categorical variables in my dataframe later on. Thanks!</p>
  
  <p><strong>EDIT</strong>
  In reply to the comment of miraculixx: I also tried the DataFrameMapper in sklearn-pandas</p>
  
  <pre><code>mapper = DataFrameMapper([
      ('id_col', None),
      ('target_col', None),
      (['col_a'], OneHotEncoder()),
      (['col_b'], OneHotEncoder())
  ])
  
  t = mapper.fit_transform(df)
  </code></pre>
  
  <p>But then I get this error: </p>
  
  <blockquote>
    <p>TypeError: no supported conversion for types : (dtype('O'),
    dtype('int64'), dtype('float64'), dtype('float64')).</p>
  </blockquote>