csv数据文件的同一列中同时包含日期和时间,但是我的python代码仅读取日期而不是时间
date = []
val = []
with open('F:/India 4 hrs 15-16.csv', 'r') as data:
csvreader = csv.reader(data)
for i in range(0,17):
next(csvreader)
for row in csvreader:
date.append(row[1])
val.append(row[3])
#for conversion into desired format
for k in range(0, len(val)):
if (val[k]== 'None') :
val[k]= 0
else :
val[k]= float(val[k])
for j in range(0,len(date)):
dates = [dt.datetime.strptime(d, '%d-%m-%Y %H:%M').date() for d in
date]
print(dates)
它只给输出日期而不是时间,错误在哪里? 数据为: below is the link to table