title: Trying to convert a dataframe column of ages to either "0" or "1" based on adults or minors
body: <pre><code>train['Age'] = train['Age'].fillna(np.mean(train['Age']))
  train['Age'] = train['Age'].astype(int)
  train['Age'].replace({'Age'&gt;=18:0},inplace=True)
  train['Age'].replace({'Age'&lt; 18:1},inplace=True) 
  </code></pre>
  <p>This above is the code I am currently running attempting. I have a dataframe column detailing a large number of ages based on passengers on the Titantic. What I am trying to do is to convert these either into &quot;0&quot; as adults, or &quot;1&quot; as minors in order to sort them for purposes of making a model.</p>
  <p>The issue that I am running into at the moment is that the code above does not function as a result of the following error message:</p>
  <p><code>'&gt;=' not supported between instances of 'str' and 'int'</code></p>
  <p>What I am trying to figure out is why that is the case still, if the as.type line exists to make sure that the list of ages is an int, so we would have a int and int comparison point.</p>