There are already plenty of question on stack overflow regarding what i am asking but i have a small doubt and because of that i think my question is different. In my time series i want to get the average per minute. My time series is something like below:-
time duration
2018-08-26T14:00:00.000Z 0.22
2018-08-26T14:00:00.000Z 0.23
2018-08-26T14:00:00.000Z 2.05
2018-08-26T14:00:00.000Z 2.5
2018-08-26T14:00:00.000Z 3.0
2018-08-26T14:00:01.000Z 30.4
2018-08-26T14:00:01.000Z 30.4
2018-08-26T14:00:01.000Z 30.4
2018-08-26T14:00:02.000Z 30.4
2018-08-26T14:00:02.000Z 30.4
2018-08-26T14:00:03.000Z 30.4
.....
2018-08-26T14:01:03.000Z 30.4
2018-08-26T14:01:03.000Z 30.4
2018-08-26T14:02:03.000Z 30.4
2018-08-26T14:02:03.000Z 30.4
As the data is from elastic search i am having multiple observation from the same second. From Multiple i mean i have may be 100 observation from one second time stamp.
I am using the below code to perform the average duration per minute which i got from Group index by minute and compute average
df.index = pd.DatetimeIndex(df.time)
df.groupby([df.index.values.astype('<M8[m]')])['duration'].mean()
I am getting my output like below
2018-08-26 14:00:00 0.151470
2018-08-26 14:01:00 0.144745
2018-08-26 14:02:00 0.147503
2018-08-26 14:03:00 0.156921
2018-08-26 14:04:00 0.142978
2018-08-26 14:05:00 0.167170
2018-08-26 14:06:00 0.156233
2018-08-26 14:07:00 0.140044
2018-08-26 14:08:00 0.135376
2018-08-26 14:09:00 0.161247
2018-08-26 14:10:00 0.134211
2018-08-26 14:11:00 0.179065
2018-08-26 14:12:00 0.145470
2018-08-26 14:13:00 0.145623
2018-08-26 14:14:00 0.139927
2018-08-26 14:15:00 0.138283
2018-08-26 14:16:00 0.137545
2018-08-26 14:17:00 0.140346
I just want to make sure if i am doing this right because i am having multiple instance for one second and I am afraid if its is considering all of it or not.
I will appreciate any kind of help here.