Hi,
I have the following code:
all help much appreciated
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:
Error:ValueError: time data '22/10/18 08:00:00' does not match format '%d/%m?%y %H:%M:%S'
for clarity the full error is:Error:Traceback (most recent call last):
File "C:/Users/ashle/PycharmProjects/CSV_Handling/TradeDataManipulation/Momentum.py", line 9, in <module>
list_stamps_date = [datetime.strptime(i,timeFormat) for i in list_stamps]
File "C:/Users/ashle/PycharmProjects/CSV_Handling/TradeDataManipulation/Momentum.py", line 9, in <listcomp>
list_stamps_date = [datetime.strptime(i,timeFormat) for i in list_stamps]
File "C:\Program Files\Python36\lib\_strptime.py", line 565, in _strptime_datetime
tt, fraction = _strptime(data_string, format)
File "C:\Program Files\Python36\lib\_strptime.py", line 362, in _strptime
(data_string, format))
ValueError: time data '22/10/18 08:00:00' does not match format '%d/%m?%y %H:%M:%S'
Process finished with exit code 1
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