The code is as follows:
for i in range(0,len(df)):
df['date'][i] = datetime.strptime(df['date'][i], '%y-%m-%d %H:%M:%S')
I got the error message:
time data ‘2019-12-06 09:00:00’ does not match format ‘%y-%m-%d %H:%M:%S’
I don’t know why it gives me this message and how to handle it?
>Solution :
The issue is %y, which truncates the year by its last two digits. You need %Y instead, which will give you four digits for the year.