I have two columns that are datetime64[ns] objects. I am trying to determine the number of months between them.
The columns are:
city_clean['last_trip_date']
city_clean['signup_date']
Format is YYYY-MM-DD
I tried
from dateutil.relativedelta import relativedelta
city_clean['months_active'] = relativedelta(city_clean['signup_date'], city_clean['last_trip_date'])
And get the following error:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Does anyone know what could cause this issue? I feel like this is the most accurate way to calculate the number of months.