I’m trying to run a script that will filter out the motor speed that doesn’t specifically have the timestamp of 9 am on every day and show two columns of the date at 9 am and the motor speed at that time for multiple days. This is my code so far.
header = ['Mtr Spd','Date']
filteredDataset = []
rawDataset = data['motor speed_1'].getCoreResults()
for row in range(rawDataset.rowCount):
if (system.date.getHour24(data['Date'])) == 9:
specificVal = rawDataset.getvalueAt(row,'mtr spd')
specificTime = rawDataset.getvalueAt(row,'t_stamp')
filteredDataset.append([specificTime, specificVal])
filteredDataset = system.dataset.toDataSet(header,filteredDataset)
data['updated Data'] = filteredDataset
The issue right now is that on line 7, the function system.date.getHour doesn’t work because data[‘t_stamp’] is not a correct date entry. However, I’m not sure what else I can use to keep track of the time. StartDate/endDate work but they don’t do what I specifically want. I’m also not sure if the query, motor speed_1, that I’m trying to extract data from has enough data to draw from since I only have a few results showing up for that query in the window.