我的熊猫数据框如下:
ID trackintime trackouttime time difference
54 2020-01-01 00:00:03 2020-01-01 00:00:05 00:00:02
55 2020-01-01 00:00:04 2020-01-01 00:00:06 00:00:02
54 2020-01-01 00:00:05 2020-01-01 00:00:10 00:00:05
55 2020-01-01 00:00:06 2020-01-01 00:00:10 00:00:04
我想将每个ID条目的时差值替换为每个ID的第一个条目(时间方向)的时差值。
结果应如下所示:
ID trackintime trackouttime time difference
54 2020-01-01 00:00:03 2020-01-01 00:00:05 00:00:02
55 2020-01-01 00:00:04 2020-01-01 00:00:06 00:00:02
54 2020-01-01 00:00:05 2020-01-01 00:00:10 00:00:02
55 2020-01-01 00:00:06 2020-01-01 00:00:08 00:00:02
在此先感谢您的帮助!
答案 0 :(得分:3)
将GroupBy.transform
与GroupBy.first
一起使用并减去值:
let webView = WKWebView()
// ...
// after loading a website with the desired string on it.
// ...
webView.find("hello world") { result in
print(result.matchFound) // true
}