title: Cannot compare types 'ndarray(dtype=int64)' and 'str'
body: <p>Example of data that I want to replace
  <a href="https://i.stack.imgur.com/6czjm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6czjm.png" alt="enter image description here" /></a></p>
  <p>Data has the following attributes</p>
  <ol>
  <li>Buying v-high,high,med,low</li>
  <li>Maint v-high,high,med,low</li>
  <li>Doors 2,3,4,5-more</li>
  <li>persons 2,4-more</li>
  <li>lug_boot small,med,big</li>
  <li>safety low,med.high</li>
  </ol>
  <p>here is what I did</p>
  <pre><code>enter code here
  #Buying price generalization 
  df[&quot;Buying_Price&quot;]=df[&quot;Buying_Price&quot;].replace({&quot;vhigh&quot;:4})
  df[&quot;Buying_Price&quot;]=df[&quot;Buying_Price&quot;].replace({&quot;high&quot;:3})
  df[&quot;Buying_Price&quot;]=df[&quot;Buying_Price&quot;].replace({&quot;med&quot;:2})
  df[&quot;Buying_Price&quot;]=df[&quot;Buying_Price&quot;].replace({&quot;low&quot;:1})
  
  #Maintanace generalization 
  df[&quot;Maintanance_price&quot;]=df[&quot;Maintanance_price&quot;].replace({&quot;vhigh&quot;:4}) 
  df[&quot;Maintanance_price&quot;]=df[&quot;Maintanance_price&quot;].replace({&quot;high&quot;:3})   
  df[&quot;Maintanance_price&quot;]=df[&quot;Maintanance_price&quot;].replace({&quot;med&quot;:2})
  df[&quot;Maintanance_price&quot;]=df[&quot;Maintanance_price&quot;].replace({&quot;low&quot;:1})
  
  #lug_boot generalization 
  df[&quot;Lug_boot&quot;]=df[&quot;Lug_boot&quot;].replace({&quot;small&quot;:1})
  df[&quot;Lug_boot&quot;]=df[&quot;Lug_boot&quot;].replace({&quot;med&quot;:2})
  df[&quot;Lug_boot&quot;]=df[&quot;Lug_boot&quot;].replace({&quot;big&quot;:3})
  
  #Safety Generalization 
  df[&quot;Safety&quot;]=df[&quot;Safety&quot;].replace({&quot;low&quot;:1})
  df[&quot;Safety&quot;]=df[&quot;Safety&quot;].replace({&quot;med&quot;:2})
  df[&quot;Safety&quot;]=df[&quot;Safety&quot;].replace({&quot;big&quot;:3})
  
  print(df.head())
  </code></pre>
  <p>while printing it showed:</p>
  <pre><code>Cannot compare types 'ndarray(dtype=int64)' and 'str'
  </code></pre>