下面是一个.csv文件的例子,我有数千条不同的总线线路。
table:
| 跳闸标识|到达时间|出发时间|stop_id|停止顺序|停车头标志|
| --|--|--|--|--|--|
| 107_1_D_1|六点四十分|六点四十分|AREI 2| 1 ||
| 107_1_D_1|六点四十分三十二秒|六点四十分三十二秒|JD4| 2 ||
| 107_1_D_1|六点四十一分二十七秒|六点四十一分二十七秒|PNG4| 3 ||
原始数据:
trip_id,arrival_time,departure_time,stop_id,stop_sequence,stop_headsign
107_1_D_1,6:40:00,6:40:00,AREI2,1,
107_1_D_1,6:40:32,6:40:32,JD4,2,
107_1_D_1,6:41:27,6:41:27,PNG4,3,
字符串
我想创建一个表或框架,为每个路段创建一条线,并计算每个到达时间之间的时间。
预期结果:
x1c 0d1x的数据
某些其他trip_id可能共享同一RoadSegment
3条答案
按热度按时间kmb7vmvb1#
我认为在这种情况下,你可以使用shift。下面是一个例子:
字符串
ulydmbyx2#
请看下面我的解决方案-这将输入数据转换为结构化的类形式,然后进行计算,然后将其放回CSV形式。
字符串
velaa5lx3#
字符串