Pandas has a single object to encapsulate date and time called Timestamp. Both Python and pandas each have a timedelta object that is useful when doing date addition/substraction.
Pandas provides the to_datetime function that will convert a string into a Timestamp object. See the following examples.See list of all units with '%' here
The to_datetime function is also capable of converting a list or DataFrame to Timestamp object.
Pandas also has Timedelta and to_timedelta to represent an amount of time.
Timedelta may be added or subtracted from Timestamp and from each other. They may even be divided from each other to return a float.
Japanese Date
Our data happens to be from a Japanese source. Using the available variables, try to convert the date into Timestamp. Save the converted column into a variable called birthday.
Make a new column in the dataset called '年齢’. This contains the age of the person. You can find the age of the person by doing the following:
Write today - birthday to get the Timedelta
Divide the days by 365, then use floor function.
Print out the new dataset in csv format called tanjoubi_nenrei.csv