I have this date column which the dtype: object
and the format is 31-Mar-20
. So i tried to turn it with datetime.strptime
into datetime64[D]
and with format of 2020-03-31
which somehow whatever i have tried it does not work, i have tried some methode from this and this. In some way, it does turn my column to datetime64
but it has timestamp in it and i don't want it. I need it to be datetime
without timestamp and the format is 2020-03-31
This is my code
dates = [datetime.datetime.strptime(ts,'%d-%b-%y').strftime('%Y-%m-%d')
for ts in df['date']]
df['date']= pd.DataFrame({'date': dates})
df = df.sort_values(by=['date'])