title: Specifying the columns using strings is only supported for pandas DataFrames
body: <p>I want to One-hot-encoding several columns and used several solutions include simple one-hot-encoding, ColumnTransformer, make_column_transformer, Pipeline, and get_dummies but anytime I have got different errors.</p>
  <pre><code>x = dataset.iloc[:, :11].values
  y = dataset.iloc[:, 11].values
  
  
  &quot;&quot;&quot; data encoding &quot;&quot;&quot;
  
  from sklearn.preprocessing import LabelEncoder, OneHotEncoder, OrdinalEncoder
  from sklearn.compose import ColumnTransformer
  from sklearn.pipeline import Pipeline
  
  
  # oe = OrdinalEncoder()
  # x = oe.fit_transform(x)
  
  non_cat = [&quot;Make&quot;, &quot;Model&quot;, &quot;Vehicle&quot;, &quot;Transmission&quot;, &quot;Fuel&quot;]
  
  onehot_cat = ColumnTransformer([
      (&quot;categorical&quot;, OrdinalEncoder(), non_cat),
      (&quot;onehot_categorical&quot;, OneHotEncoder(), non_cat)],
      remainder= &quot;passthrough&quot;)
  x = onehot_cat.fit_transform(x)
  </code></pre>
  <p>error:</p>
  <pre><code>[['ACURA' 'ILX' 'COMPACT' ... 6.7 8.5 33]
  ['ACURA' 'ILX' 'COMPACT' ... 7.7 9.6 29]
  ['ACURA' 'ILX HYBRID' 'COMPACT' ... 5.8 5.9 48]
  ...
  ['VOLVO' 'XC60 T6 AWD' 'SUV - SMALL' ... 8.6 10.3 27]
  ['VOLVO' 'XC90 T5 AWD' 'SUV - STANDARD' ... 8.3 9.9 29]
  ['VOLVO' 'XC90 T6 AWD' 'SUV - STANDARD' ... 8.7 10.7 26]]
  ---------------------------------------------------------------------------
  AttributeError                            Traceback (most recent call last)
  ~\Anaconda3\lib\site-packages\sklearn\utils\__init__.py in _get_column_indices(X, key)
  424         try:
  --&gt; 425             all_columns = X.columns
  426         except AttributeError:
  
  AttributeError: 'numpy.ndarray' object has no attribute 'columns'
  
  During handling of the above exception, another exception occurred:
  
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-4-4008371c305f&gt; in &lt;module&gt;
   24     (&quot;onehot_categorical&quot;, OneHotEncoder(), non_cat)],
   25     remainder= &quot;passthrough&quot;)
   ---&gt; 26 x = onehot_cat.fit_transform(x)
   27 
   28 print('OneHotEncode = ', x.shape)
  
  ~\Anaconda3\lib\site-packages\sklearn\compose\_column_transformer.py in fit_transform(self, X, y)
  527         self._validate_transformers()
  528         self._validate_column_callables(X)
  --&gt; 529         self._validate_remainder(X)
  530 
  531         result = self._fit_transform(X, y, _fit_transform_one)
  
  ~\Anaconda3\lib\site-packages\sklearn\compose\_column_transformer.py in _validate_remainder(self, X)
  325         cols = []
  326         for columns in self._columns:
  --&gt; 327             cols.extend(_get_column_indices(X, columns))
  328 
  329         remaining_idx = sorted(set(range(self._n_features)) - set(cols))
  
  ~\Anaconda3\lib\site-packages\sklearn\utils\__init__.py in _get_column_indices(X, key)
  425             all_columns = X.columns
  426         except AttributeError:
  --&gt; 427             raise ValueError(&quot;Specifying the columns using strings is only &quot;
  428                              &quot;supported for pandas DataFrames&quot;)
  429         if isinstance(key, str):
  </code></pre>
  <p>ValueError: Specifying the columns using strings is only supported for pandas DataFrames</p>