问题
I have a dataset with an uneven sample frequency as seen on this subset:
time date x y id nn1 nn2
0 2019-09-17 08:43:06 234 236 4909 22.02271554554524 38.2099463490856
0 2019-09-17 08:43:06 251 222 4911 22.02271554554524 46.57252408878007
1 2019-09-17 08:43:07 231 244 4909 30.4138126514911 41.617304093369626
1 2019-09-17 08:43:07 252 222 4911 30.4138126514911 46.57252408878007
1 2019-09-17 08:43:07 207 210 4900 41.617304093369626 46.57252408878007
2 2019-09-17 08:43:08 234 250 4909 33.28663395418648 48.82622246293481
2 2019-09-17 08:43:08 206 210 4900 47.53945729601885 48.82622246293481
3 2019-09-17 08:43:09 252 222 4911 38.28837943815329 47.53945729601885
3 2019-09-17 08:43:09 206 210 4900 40.718546143004666 47.53945729601885
3 2019-09-17 08:43:09 223 247 4909 38.28837943815329 40.718546143004666
4 2019-09-17 08:43:10 206 210 4900 35.4682957019364 47.53945729601885
4 2019-09-17 08:43:10 229 237 4909 27.459060435491963 35.4682957019364
4 2019-09-17 08:43:10 252 222 4911 27.459060435491963 47.53945729601885
5 2019-09-17 08:43:12 226 241 4909 30.805843601498726 38.01315561749642
5 2019-09-17 08:43:12 251 223 4911 30.805843601498726 44.94441010848846
5 2019-09-17 08:43:12 209 207 4900 38.01315561749642 44.94441010848846
6 2019-09-17 08:43:13 251 222 4911 34.20526275297414 44.598206241955516
6 2019-09-17 08:43:13 224 243 4909 34.20526275297414 39.0
6 2019-09-17 08:43:13 209 207 4900 39.0 44.598206241955516
7 2019-09-17 08:43:14 251 222 4911 33.421549934136806 45.5411901469428
7 2019-09-17 08:43:14 225 243 4909 33.421549934136806 39.81205847478876
8 2019-09-17 08:43:15 225 245 4909 34.713109915419565 41.23105625617661
8 2019-09-17 08:43:15 209 207 4900 41.23105625617661 44.598206241955516
8 2019-09-17 08:43:15 251 222 4911 34.713109915419565 44.598206241955516
9 2019-09-17 08:43:16 209 207 4900 37.20215047547655 48.46648326421054
9 2019-09-17 08:43:16 254 225 4911 25.942243542145693 48.46648326421054
10 2019-09-17 08:43:18 206 207 4900 41.182520563948 67.26812023536856
10 2019-09-17 08:43:18 242 227 4909 30.805843601498726 41.182520563948
10 2019-09-17 08:43:18 272 220 4911 30.805843601498726 67.26812023536856
I want to reshape the data set into even 0.25 Seconds intervals (increasing the sample frequency to 4 fps) and fill the Nan Values with average values of the given second. I fail with interpolating and reshaping, is there anyone that can help?? Also, the ID has to stay the same. I deeply appreciate!
来源:https://stackoverflow.com/questions/59460804/how-to-reshape-and-interpolate-df-into-even-time-intervals-and-fill-the-nan-valu