I have a Dataframe that has some trip data where every row represents data for every point/location.
trip_id, sequence, location, start_time
101, 1, point_a, 2020-05-01 00:00:01
101, 2, point_b, 2020-05-01 00:04:01
101, 3, point_c, 2020-05-01 00:14:01
102, 1, point_x, 2020-05-11 00:13:21
102, 2, point_y, 2020-05-11 00:14:01
103, 1, point_z, 2020-05-11 00:14:01
103, 3, point_za, 2020-05-11 00:20:01
I am trying to create a new dataframe that has data between two consecutive points / locations in the same row as shown below:
trip_id, sequence, start_location, start_time, sequence, end_location, end_time
101, 1, point_a, 2020-05-01 00:00:01, 2, point_b, 2020-05-01 00:04:01
101, 2, point_b, 2020-05-01 00:04:01, 3, point_c, 2020-05-01 00:14:01
102, 1, point_x, 2020-05-11 00:13:21, 2, point_y, 2020-05-11 00:14:01
103, 1, point_z, 2020-05-11 00:14:01, 3, point_za, 2020-05-11 00:20:01