I have a dataset with the GPS coordinates and the timestamp of an individual's trajectory. It looks like this:
The data is recorded with a smartphone app, and it is designed to collect data every second, as you can see in the image. However, as you also note, in some cases (due to gps errors or satellite connection) the data is collected over a longer period of time (in the figure the first time difference is 2 seconds for example, but in some cases is even longer, being 4-5 seconds or more).
For my study, I need the GPS coordinates (latitude and longitude) every 1 second, so I thought I'd do an interpolation, creating new rows of data with the coordinates and time missing in each case.
I have been investigating for a long time but I can't find any way to do it. My idea is to create first the rows with "NaN" values, reindexing them, and then filling the columns of latitude, longitude and time using the interpolation function: df.interpolate(). But I can' t figure out how to do it.
If anyone has any ideas on how to do this it would be a great help to me.
Thank you very much.