title: Unable to change categorical data in one column (pandas, Machine Learning)
body: <p>I have started with machine learning and already stuck on some task.
  I want to set up (preprocessing) the table columns because the data in the columns are categorical. I have successfully process (change values) all columns except the last one. The data file from which I load (<code>dataset =  pd.read_csv(&quot;car.data&quot;)</code>) my values is car.data (I downloaded it from internet). To mention I am using pandas and all important libraries for ML (tensorflow, sklearn, numpy...).</p>
  <p>When I run my code all columns are filled with numbers and only last one is filled with &quot;None&quot;. I have noticed when I run: <code>dataset.unacc.unique()</code>, I get this output:
  <code>array([None], dtype=object)</code> and it should not be of type object. In correct code is different: <code>array([0, 1, 3, 2], dtype=int64)</code>.</p>
  <p>Can anyone help me with this problem? I couldn't find it on Internet. Thank you in advance.</p>
  <p>Here is my code:</p>
  <pre><code>dataset.unacc.unique()
  </code></pre>
  <p>This is function to change values in a column:</p>
  <pre><code>def label_fixTarget(something):
      if something=='unacc':
          return 0
      elif something=='acc':
          return 1
      elif something=='vgood':
          return 3
      elif something==&quot;good&quot;:
          return 2 
  </code></pre>
  <pre><code>dataset['unacc'] = dataset['unacc'].apply(label_fixTarget)
  dataset.unacc.unique()
  dataset.head()
  </code></pre>
  <p>And this is my new table:</p>
  <p><a href="https://i.stack.imgur.com/RiZWe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RiZWe.png" alt="enter image description here" /></a></p>