Calculate the Days Between Two Dates
Python
In this example we calculate the days between the current date and the date an order was placed in the orders dataframe.
1| import datetime as dt 2| 3| orders['today'] = pd.to_datetime(dt.date.today()) 4| orders['days_since_order'] = (orders['today'] - orders['Order_Date']).dt.days
133
121
116
109