I have come across some examples that show how to calculate the difference between two dates using .days. However for some reason does not seem to be working for me. I have the following code:
import datetime
from datetime import date
dfPort = pd.read_csv('C:\\Research\\Lockup\\Data\\lockupdates.csv')
dfPort = pd.DataFrame(dfPort)
todaysDate=datetime.datetime.today()
dfPort['LDate']=pd.to_datetime(dfPort['LockupExpDate'], format='%m/%d/%Y')
dfPort['TimeLeft']=(todaysDate-dfPort['LDate']).days
I get the following error:
AttributeError: 'Series' object has no attribute 'days'
So I tried the following:
xx=dfPort['LDate']-todaysDate
xx.days
and got the same error message. The references in Stack Overflow that I was reading are: Difference between two dates in Python
How to fix?