How can I calculate the age of a person (based off the dob column) and add a column to the dataframe with the new value?
dataframe looks like the following:
Use this one liner when you are trying to find the age from date of birth column with current year
import pandas as pd df["dob"] = pd.to_datetime(data["dob"]) df["age"] = df["dob"].apply(lambda x : (pd.datetime.now().year - x.year))