cannot convert the series to

Your error is line 2. df['intage'] = int(df['age']) is not valid, you can’t pass a pandas series to the int function.

You need to use astype if df[‘age’] is object dtype.

df['intage'] = df['age'].astype(int)

Or since you are subtracting two dates, you need to use dt accessor with the days attribute to get the number of days as an integer

df['intage'] = df['age'].dt.days

Leave a Comment