I have two variables : One is epoch time and other is normal datetime,
df['epochtime']
0 1457586382
1 1457586382
2 1457586391
3 1457586692
4 1457586391
5 1457586391
6 1457586692
7 1457586692
8 1457572611
df['time']
0 2016-03-10 00:06:21.903
1 2016-03-10 00:06:21.908
2 2016-03-10 00:06:30.895
3 2016-03-10 00:06:30.895
4 2016-03-10 00:06:30.899
5 2016-03-10 00:06:30.899
6 2016-03-10 00:06:31.045
7 2016-03-10 00:06:31.094
8 2016-03-10 01:16:51.390
I want the difference between these two times in seconds. The following is my trying,
pd.to_datetime(df['epochtime'], unit ='s' ) - df['time']
The following is my output,
0 00:00:00.097000
1 00:00:00.092000
2 00:00:00.105000
3 00:05:01.105000
4 00:00:00.101000
5 00:00:00.101000
6 00:05:00.955000
7 00:05:00.906000
8 -1 days +23:59:59.610000
I want to make this as integer in seconds. Also for the 8th value for some strange reason getting difference as -1 days, where it should be seconds only. Can anybody help me getting the seconds difference as integer ?