0

I am trying to subtract today's date from a date column:

pd.to_datetime(df['Date'])-datetime.datetime.now().date()

But getting an error:

TypeError: unsupported operand type(s) for -: 'DatetimeInde' and 'datetime.date'
pc_pyr
  • 562
  • 5
  • 20
  • 3
    Does this answer your question? [pandas: subtracting current date from the date in a pandas table](https://stackoverflow.com/questions/53867536/pandas-subtracting-current-date-from-the-date-in-a-pandas-table) – 0buz May 15 '20 at 13:09

1 Answers1

1

Current datetime comes up in datetime object form, find the type of data you are getting, convert into datetime format, if str to datetime you can refer to the below link.

https://www.journaldev.com/23365/python-string-to-datetime-strptime

Cheers