I have this table which contains column DateOfBirth like this :
Gender FullName DateOfBirth
0 Male Stan Smith 1980-02-10
1 Male Nikola Griffin 1999-12-20
2 Female Ruby Moore 1986-03-03
I want to find out the age of each fullname, based on this answer https://stackoverflow.com/a/26789573/12582712, I am doing this
import datetime as DT
import io
import numpy as np
import pandas as pd
name = {'Gender': ['Male','Male','Female'],
'FullName': ['Stan Smith','Nikola Griffin','Ruby Moore'],
'DateOfBirth' : ['1980-02-10', '1999-12-20', '1986-03-03']
}
df = pd.DataFrame(name, columns = ['Gender', 'FullName', 'DateOfBirth'])
now = pd.Timestamp('now')
df['DateOfBirth'] = pd.to_datetime(df['DateOfBirth'], format='%y%m%d'
but when I am doing the last code, it says ValueError: time data '1980-02-10' does not match format '%y%m%d' (match)