Input file "clockTimes2020-40.xlsx" is CSV. Times are in columns. I want to calculate the time difference, "dur", as number of hours in float float, but I get the error message indicated.
import pandas
import datetime
print('pandas.__version__:',pandas.__version__)
df = pandas.read_excel('clockTimes2020-40.xlsx', sheet_name='clockTimes2020-40')
line0 = df.loc[0]
print('line0: ',line0)
print('line0 type is ',type(line0))
beg = line0[4]
end = line0[5]
print('beg = ',beg, 'type: ',type(beg))
print('end = ',end, 'type: ',type(end))
dur = end - beg
print('dur = ',dur,'type:',type(dur))
RESULTS runfile('C:/Users/Muir/ABCorp/untitled0.py', wdir='C:/Users/Muir/ABCorp') pandas.version: 1.1.3 line0: CID 1 Lname Adams Fname Francis J Mon 2020-09-28 00:00:00 Moin 08:00:10 Moout 17:16:24 Tue 2020-09-29 00:00:00 Tuin 07:58:41 Tuout 16:55:55 Wed 2020-09-30 00:00:00 Wein 07:53:00 Weout 17:45:45 Thu 2020-10-01 00:00:00 Thin 07:53:00 Thout 17:45:45 Fri 2020-10-02 00:00:00 Frin 07:53:00 Frout 16:59:45 Sat 2020-10-03 00:00:00 Sain 00:00:00 Saout 00:00:00 Sun 2020-10-04 00:00:00 Suin 00:00:00 Suout 00:00:00 Name: 0, dtype: object line0 type is <class 'pandas.core.series.Series'> beg = 08:00:10 type: <class 'datetime.time'> end = 17:16:24 type: <class 'datetime.time'> Traceback (most recent call last): File "C:\Users\Muir\ABCorp\untitled0.py", line 21, in dur = end - beg TypeError: unsupported operand type(s) for -: 'datetime.time' and 'datetime.time'