title: How to calculate number of years between two dates in different pandas columns
body: <p>One column has dates but the other has a string containing a date, so I first need to extract the date part from that string.</p>
  
  <pre><code>import pandas as pd
  import datetime
  from dateutil.relativedelta import relativedelta
  
  # the dataframe - id column always starts with year, month and day
  df = pd.DataFrame({'id': ['19520630F8', '19680321A5', '19711113E2'],
                     'dte': ['2010-06-02', '2007-08-12', '2013-01-23']})
  
  # create a date string from df['id'] to the format yyyy-mm-dd
  dob = (df['id'].str[:4] + '-' +
         df['id'].str[4:6] + '-' +
         df['id'].str[6:8])
  
  # calculate age (years only) at df['dte']
  df['age'] = relativedelta(date, dob).years
  </code></pre>
  
  <p>I get the error message:</p>
  
  <blockquote>
    <p>ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().</p>
  </blockquote>
  
  <p>I don't understand the ambiguousness of my data, and where to apply those empty/bool/item...
  The <code>df['dta']</code> column if of object data type and not datetime, but wrapping the creation of dob in <code>pd.to_datetime</code> wont help.</p>
  
  <p>EDIT
  The expected output should be</p>
  
  <pre><code>          dte          id  age
  0  2010-06-02  19520630F8   57
  1  2007-08-12  19680321A5   39
  2  2013-01-23  19711113E2   41
  </code></pre>