I have the following pandas dataframe
I want to subtract date_of_birth from date_of_death to make a new column, "years_lived" to contain the years lived. I tried all 3 ways below (individually of course)
df['years_lived'] = (df['date_of_death'] - df['date_of_birth']).dt.days
df['years_lived'] = df['date_of_death'].sub(df['date_of_birth'], axis=0)
df['years_lived'] = df['date_of_death'] - df['date_of_birth']
but I got a TypeError: unsupported operand type(s) for -: 'str' and 'str'