title: Add column to a Python pandas DataFrame based on values in an other column
body: <p>I would like to add a column to a pandas DataFrame based on the value in one of the other columns.</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  
  Records = 100
  
  df = pd.DataFrame (
          {'ID' : range(1, Records + 1),
           'Group' : np.random.choice(range(1, 41), Records, replace = True)
           }
          )
  
  def Age(x):
      a = list()
      for i in x:
          if (i &gt;= 14 and i &lt;= 20) or (i &gt;= 34 and i &lt;= 40):
              a.append('65+')
          else:
              a.append('65-')
      return a
  
  df['Age'] = Age(df.Group)
  
  print(df.head(10))
  
      Group  ID  Age
  0      11   1  65-
  1       1   2  65-
  2       6   3  65-
  3      32   4  65-
  4      31   5  65-
  5      39   6  65+
  6      26   7  65-
  7      38   8  65+
  8      26   9  65-
  9      31  10  65-
  </code></pre>
  
  <p>This does the job, but I prefer using a lambda function if possible but can't get it working. Or if possible create the Age column at creation of the dataframe. Any suggestions?</p>