Я пытаюсь преобразовать строку, содержащую часы, минуты и секунды, в datetime из файла csv, но всегда получаю сообщение об ошибке "ValueError: данные времени" create_at "не соответствуют формату"% Y /% m /% d% H ":%МИЗ'".Код следующий:
import csv
from dateutil.parser import parse
import pandas as pd
import time
from datetime import datetime
path = r'C:\Users\Ahmed Ismail Khalid\Desktop\test\_jonasschnelli__tweets.csv'
with open(path,'rt',encoding="utf-8") as f :
reader = csv.reader(f)
for row in reader :
print(row[1])
print("Converted time is :", datetime.strptime(row[1], '%d/%m/%Y %H:%M:%S'))
CSV-файл в формате:
id | created_at | text
1 | 1/15/2018 6:12:16 AM | this is sample text
2 | 1/11/2018 6:58:27 AM | this is sample text
3 | 1/10/2018 9:39:33 PM | this is sample text
4 | 1/10/2018 8:47:35 PM | this is sample text
Любая помощь будет оценена.
Спасибо