Time Data does not match format - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: Time Data does not match format (/thread-14050.html) |
Time Data does not match format - AshBax - Nov-12-2018 Hi, I have the following code: import pandas as pdm from datetime import datetime,timedelta timeFormat = '%d/%m?%y %H:%M:%S' dataFrame = pdm.read_csv('C:\\', sep=',', index_col=None) list_stamps = dataFrame['Timestamp'].tolist() list_stamps_date = [datetime.strptime(i,timeFormat) for i in list_stamps]and unfortunately, when i'm trying to read the following string "22/10/18 08:00:00" i get the following error: for clarity the full error is: I'm early stages of teaching myself python so I'm sure someone will groan at my stupidity, but I can't seem to spot the obvious problem!!!.all help much appreciated RE: Time Data does not match format - buran - Nov-12-2018 you have ? instead of / in the format string%d/%m?%y %H:%M:%S RE: Time Data does not match format - AshBax - Nov-13-2018 Haha - I'm so sorry you actually had to look at that. Thanks so much..... really appreciate it |