How to find date difference between dates in DataFrame and today’s date in a specific format by defining a function?

  dataframe, jupyter-notebook, pandas, python

I have created the DataFrame with the range of dates

date_range = pd.DataFrame({'Date': pd.date_range(date(2021,3,1),, freq='5D')})
df1 = date_range['Date'].dt.strftime('%m/%d/%Y')
df = pd.DataFrame({'Date': df1})

Then I call a function to get today’s date:

date_today =
date_today1 =, "%m/%d/%Y")

After trying to substract it from all data range, receiving an error:

TypeError: unsupported operand type(s) for -: 'str' and 'str'

I understand that the error in the format, but just don’t know how to fix it.

Appreciate your help!

Source: Python Questions