I have below two columns in this dataframe.
DATE1 DATE2
2020-07-08 23:54:17.0 2020-07-09 19:00:56.9970000
2020-07-08 08:22:28.0 2020-07-08 13:23:10.3630000
2020-07-08 10:24:25.0 2020-07-08 13:25:30.8990000
2020-07-08 20:19:35.0 2020-07-09 18:57:07.6900000
2020-07-08 06:07:45.0 2020-07-08 13:20:49.9960000
2020-07-08 10:20:25.0 2020-07-08 13:25:20.0390000
2020-07-08 19:18:23.0 2020-07-09 18:56:06.6550000
2020-07-08 22:12:03.0 2020-07-09 18:59:11.6250000
2020-07-08 09:38:44.0 2020-07-08 13:24:44.9820000
2020-07-08 09:54:44.0 2020-07-08 13:24:45.3750000
2020-07-08 06:23:45.0 2020-07-08 13:21:05.5150000
2020-07-08 18:49:17.0 2020-07-09 18:55:41.9710000
2020-07-08 19:47:23.0 2020-07-09 18:56:37.7690000
2020-07-08 10:48:25.0 2020-07-08 13:25:45.0060000
2020-07-08 05:30:45.0 2020-07-08 13:20:15.8920000
2020-07-08 06:09:45.0 2020-07-08 13:20:54.9810000
I would want to find the difference between these timestamps and add a boolean column which says if the difference between these two dates is greater than 24 hours or not.
I tried out the foloowing snippet but got the error: 'unsupported operand type(s) for -: 'str' and 'str''
df['diff_hours'] = df['DATE2'] - df['DATE1']
df['diff_hours']= df['diff_hours']/np.timedelta64(1,'h')
Can someone help me out with this snippet or have some other way around to tackle this easily? Thanks in advance!