Hiya so I have a data frame which has the time something occurs in one column and the time that it ends in the next column. I need to try and find the time difference between the two, but theyre both strings so it wont simply let me compare them, is there a way I can change them to ints (theyre in the format HH:MM:SS) I found a way to split them using .split (I've put what I did for the original time below, the I could do the same for the second column and work them out from there, but I was wondering if there was an easier way?
...
TIA!
q = 0
for int in range(long):
intel = df_data_bad_time1.loc[q,'Time']
H_M_S = intel.split(':')
df_data_bad_time1.loc[q,'Hours'] = H_M_S[0]
df_data_bad_time1.loc[q,'Mins'] = H_M_S[1]
df_data_bad_time1.loc[q,'Secs'] = H_M_S[2]
q = q + 1
df_data_bad_time1['Hours'] = pd.to_numeric(df_data_bad_time1['Hours'], errors='coerce').astype('Int64')
df_data_bad_time1['Mins'] = pd.to_numeric(df_data_bad_time1['Mins'], errors='coerce').astype('Int64')
df_data_bad_time1['Secs'] = pd.to_numeric(df_data_bad_time1['Secs'], errors='coerce').astype('Int64')
df_data_bad_time1.head(15)
question from:
https://stackoverflow.com/questions/65886276/converting-time-to-take-away 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…