I'm trying to compute the age of a person from the data that I have:
Data columns in 'Person' Dataframe:
TodaysDate non-null datetime64[ns]
YOB non-null float64
So I want to make a new column inside that dataframe called 'Age' and so far I have the following code:
Person['Age'] = map(sum, (Person.ix[0,'TodaysDate']).year, -(Person['YOB']))
TypeError: 'int' object is not iterable
I've also tried:
Person['Age'] = map((Person.ix[0,'TodaysDate']).year - Person['YOB'])
TypeError: map() must have at least two arguments.
I've tried a few different methods that were posted on other questions but none seem to work. This seems very simple to do...but can't get it to work.
Any ideas how I can use the map function to subtract the datetime column TodaysDate
from the float column YOB
to and put the value into Age
column? I'd like to do this for every row in the dataframe.
Thank you!