Let's say I have a data frame customer:
Name   DOB         Age?
A     12/10/1953
B     16/12/1980
C     20/01/1954
D     03/10/1961
E     13/05/1977
After calculating age I want to populate it in the Age column. Can anyone help in doing this?
Let's say I have a data frame customer:
Name   DOB         Age?
A     12/10/1953
B     16/12/1980
C     20/01/1954
D     03/10/1961
E     13/05/1977
After calculating age I want to populate it in the Age column. Can anyone help in doing this?
 
    
    Coerce DOB to datetime and subtract from today's date if you wanted current age in years.
import pandas as pd
import datetime as dt
df['Age?']=(dt.datetime.today()\
            -pd.to_datetime(df['DOB'])).astype('timedelta64[Y]')
Name         DOB  Age?
0    A  12/10/1953  66.0
1    B  16/12/1980  39.0
2    C  20/01/1954  66.0
3    D  03/10/1961  59.0
4    E  13/05/1977  43.0
