I am trying to read some data from an excel file. One of the columns has time values in the format HH: MM: SS. Xlrd reads this time and converts it to a float. I have other time values in my python file that I want to compare with the time values imported by excel. I can’t do this while one of them is “time” and the other is “floating”. Any suggestions?
This is what my excel file looks like -
Time L_6_1 PW_6_1 Tc_6_1 Te_6_1 0:00:00 10000 500 290 270 1:00:00 10000 600 290 270 2:00:00 10000 700 290 270 3:00:00 10000 800 290 270 4:00:00 10000 900 290 270
And this is how I read this data -
wb=xlrd.open_workbook('datasheet.xls') sh = wb.sheet_by_index(0) timerange=sh.col_values(0) print timerange
This is a result with float values for time -
[u'Time', 0.0, 0.041666666666666664, 0.083333333333333301, 0.125, 0.166666666666 66699, 0.20833333333333301, 0.25, 0.29166666666666702, 0.33333333333333298, 0.37 5, 0.41666666666666702, 0.45833333333333298, 0.5, 0.54166666666666696, 0.5833333 3333333304, 0.625, 0.66666666666666696, 0.70833333333333304, 0.75, 0.79166666666 666696, 0.83333333333333304, 0.875, 0.91666666666666696, 0.95833333333333304]