我在Pandas中有多个数据框,都具有相同的结构。如果某些条件匹配,我想提取df1的时间戳,然后向这些时间戳添加一些时间,并通过这些时间戳访问df2。有什么想法可以指出我正确的方向吗?
Timestamp count speed
2017-01-01 12:01:00 0 65
2017-01-01 12:02:00 1 82
2017-01-01 12:03:00 0 87
2017-01-01 12:04:00 0 82
2017-01-01 12:05:00 0 81
2017-01-01 12:06:00 1 81
1. Store Timestamps if count equals 1
t0 = df1.loc[(df.count == 1)].index
2. Extract Speed of those occurences
v = df1.loc[(df.count == 1)&,'vKfz']
3. Calculate time travelled
t1 = s/v
4. Add t1 to t0 with Time delta t1
?
5. Access another df2 by the new timestamp
?