This is occurring because the formats of df['formatted_date'] and '2024-08-05' are different, this can be fixed by adding this simple line: df['formatted_date'] = df['formatted_date'].dt.strftime("%Y-%m-%d")
df['formatted_date']
df['formatted_date'] = df['formatted_date'].dt.strftime("%Y-%m-%d")