title: Pandas Dataframe Column Value Conversion from string to binary
body: <p>I am trying to convert string values in a column to binary values.For example in the below table - the mapping will be like this {'cinema':0, 'education':1}.</p>
  <p><a href="https://i.stack.imgur.com/2rexw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2rexw.png" alt="enter image description here" /></a></p>
  <p>I have defined a small function as below -</p>
  <pre><code>def numconv(a):
  return a.map({'education' : 1,'cinema' : 0})
  </code></pre>
  <p>and then I have used 'apply' function to update the values in the dataframe -</p>
  <pre><code>train_docs['Class'] = train_docs['Class'].apply(numconv)
  </code></pre>
  <p>But I am getting error as below -</p>
  <p><a href="https://i.stack.imgur.com/EMGIx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EMGIx.png" alt="enter image description here" /></a></p>
  <p>What I am doing wrng here?It should work as per my understanding.</p>