Search code examples
pythonpandasdatetimedatetime-formatpython-datetime

keep only year month and day in datetime dataframe pandas


Could anyone help me to delete the hours and minutes from this datetimes please? I used this code but it stills returning the same output!

data["expected_Date"]=pd.to_datetime(data["Last_Date"]+ timedelta(days=365*2.9),format = '%Y-%m-%d') 

but it returns always this type 2019-01-22 12:00:00 but I want to keep only this 2019-01-22 how can I manage with that please? Thank you!


Solution

  • data["expected_Date"].dt.date