def get_age(row):
    """Calculate the age of patient by row
    Arg:
        row: the row of pandas dataframe.
        return the patient age
    """
    raw_age = row['DOD'].year - row['DOB'].year
    if (row['DOD'].month < row['DOB'].month) or ((row['DOD'].month == row['DOB'].month) and (row['DOD'].day < row['DOB'].day)):
        return raw_age - 1
    else:
        return raw_age