title: One-hot-encoding multiple columns in sklearn and naming columns
body: <p>I have the following code to one-hot-encode 2 columns I have.</p>
  
  <pre><code># encode city labels using one-hot encoding scheme
  city_ohe = OneHotEncoder(categories='auto')
  city_feature_arr = city_ohe.fit_transform(df[['city']]).toarray()
  city_feature_labels = city_ohe.categories_
  city_features = pd.DataFrame(city_feature_arr, columns=city_feature_labels)
  
  phone_ohe = OneHotEncoder(categories='auto')
  phone_feature_arr = phone_ohe.fit_transform(df[['phone']]).toarray()
  phone_feature_labels = phone_ohe.categories_
  phone_features = pd.DataFrame(phone_feature_arr, columns=phone_feature_labels)
  </code></pre>
  
  <p>What I'm wondering is how I do this in 4 lines while getting properly named columns in the output. That is, I can create a properly one-hot-encoded array by include both columns names in <code>fit_transform</code> but when I try and name the resulting dataframe's columns, it tells me that there is a mismatch between the shape of the indices:</p>
  
  <pre><code>ValueError: Shape of passed values is (6, 50000), indices imply (3, 50000)
  </code></pre>
  
  <p>For background, both phone and city have 3 values. </p>
  
  <pre><code>    city    phone
  0   CityA   iPhone
  1   CityB Android
  2   CityB iPhone
  3   CityA   iPhone
  4   CityC   Android
  </code></pre>