I have a column 'datedif' in my dataframe as :
exposuredate min_exposure_date datedif
2014-10-08 2014-09-27 11 days
2014-10-09 2014-09-27 12 days
2014-09-27 2014-09-27 0 days
2014-09-27 2014-09-27 0 days
2014-10-22 2014-09-27 25 days
data.exposuredate = pd.to_datetime(data.exposuredate)
data.min_exposure_date = pd.to_datetime(data.min_exposure_date)
data['datedif'] = ((data.exposuredate)-(data.min_exposure_date))
The format for the columns are datetime64[ns]. I want to extract the number of days in the field 'datedif'. I am not able to find anything which could help me to extract the difference in terms of number of days.
I tried:
data['datedif_day'] = data['datedif'].dt.days
Error:
AttributeError: 'Series' object has no attribute 'dt'