Subtracting times taken from a .csv in python
elif row[inc3].startswith('LIGHT ON'):
onstr = row[inc3 + 1]
onlst.append(onstr)
elif row[inc4].startswith('LIGHT OFF'):
offstr = row[inc4 + 1]
offlst.append(offstr)
for idx, val in enumerate(onlst):
tdifflst.append(float(offlst[idx]) - float(onlst[idx]))
Here I pulled out the code from a script that extracts data from an EXCEL
spreadsheet and analyzes it. The two types of values are the time a light
turned on and the time a light turned off. For instance light on at 0500
and light off at 2300.
I want to subtract the on time from the off time but I obviously can't
treat these as true floats because of the 60 minutes to an hour thing. How
do I treat these "floats" like the times they are?
No comments:
Post a Comment