我写了一个python程序,它用python获取特定日期的csv数据。我还想得到特定时间的数据,比如在特定日期的2小时。但问题是,在我的csv文件中,日期和时间存储在不同的列中(col 2代表时间),我还想将数据绘制在一个图形上。这是我的代码:from_raw = self.userInputFromRaw.get()
from_date = datetime.date(*map(int, from_raw.split('/')))
print ('From date: = ' + str(from_date))
to_raw = self.userInputToRaw.get()
to_date = datetime.date(*map(int, to_raw.split('/')))
in_file = 'C:\\Users\Lala Rushan\Downloads\ARIF Drop Monitoring Final\ARIF Drop Monitoring Final\DataLog.CSV'
in_file= csv.reader(open(in_file,"r"))
for line in in_file:
_dist = line[0]
try:
file_date = datetime.date(*map(int, line[1].split(' ')[1].split('/')))
if from_date <= file_date <= to_date:
self.CsvImport(in_file)
except IndexError:
pass
有谁能告诉我如何获得特定日期(由用户拍摄)的特定时间间隔的数据并将其绘制在图表上?我不知道如何同时提取日期和时间。在
我的Csv文件如下所示:
^{pr2}$