I'm trying to get number of days between two dates using below function
df['date'] = pd.to_datetime(df.date)
# Creating a function that returns the number of days
def calculate_days(date):
today = pd.Timestamp('today')
return today - date
# Apply the function to the column date
df['days'] = df['date'].apply(lambda x: calculate_days(x))
The results looks like this
153 days 10:16:46.294037
but I want it to say 153. How do I handle this?