title: How to perform OneHotEncoding in Sklearn, getting value error
body: <p>I just started learning machine learning, when practicing one of the task, I am getting value error, but I followed the same steps as the instructor does.</p>
  
  <p>I am getting value error, please help.</p>
  
  <p>dff</p>
  
  <pre><code>     Country    Name
   0     AUS      Sri
   1     USA      Vignesh
   2     IND      Pechi
   3     USA      Raj
  </code></pre>
  
  <p>First I performed labelencoding,</p>
  
  <pre><code>X=dff.values
  label_encoder=LabelEncoder()
  X[:,0]=label_encoder.fit_transform(X[:,0])
  
  out:
  X
  array([[0, 'Sri'],
         [2, 'Vignesh'],
         [1, 'Pechi'],
         [2, 'Raj']], dtype=object)
  </code></pre>
  
  <p>then performed One hot encoding for the same X</p>
  
  <pre><code>onehotencoder=OneHotEncoder( categorical_features=[0])
  X=onehotencoder.fit_transform(X).toarray()
  </code></pre>
  
  <p>I am getting the below error:</p>
  
  <pre><code>ValueError                                Traceback (most recent call last)
  &lt;ipython-input-472-be8c3472db63&gt; in &lt;module&gt;()
  ----&gt; 1 X=onehotencoder.fit_transform(X).toarray()
  
  C:\ProgramData\Anaconda3\lib\site-packages\sklearn\preprocessing\data.py in fit_transform(self, X, y)
     1900         """
     1901         return _transform_selected(X, self._fit_transform,
  -&gt; 1902                                    self.categorical_features, copy=True)
     1903 
     1904     def _transform(self, X):
  
  C:\ProgramData\Anaconda3\lib\site-packages\sklearn\preprocessing\data.py in _transform_selected(X, transform, selected, copy)
     1695     X : array or sparse matrix, shape=(n_samples, n_features_new)
     1696     """
  -&gt; 1697     X = check_array(X, accept_sparse='csc', copy=copy, dtype=FLOAT_DTYPES)
     1698 
     1699     if isinstance(selected, six.string_types) and selected == "all":
  
  C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\validation.py in check_array(array, accept_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, warn_on_dtype, estimator)
      380                                       force_all_finite)
      381     else:
  --&gt; 382         array = np.array(array, dtype=dtype, order=order, copy=copy)
      383 
      384         if ensure_2d:
  
  ValueError: could not convert string to float: 'Raj'
  </code></pre>
  
  <p>Please edit my question is anything wrong, thanks in advance!</p>