我有一个python中的pandas数据帧,有几个列和一个日期时间戳。其中一列有true/false变量。我想计算时间,直到那个列为假。你知道吗
理想的情况是这样:
datetime delivered secondsuntilfailure
2014-05-01 01:00:00 True 3
2014-05-01 01:00:01 True 2
2014-05-01 01:00:02 True 1
2014-05-01 01:00:03 False 0
2014-05-01 01:00:04 True ?
提前谢谢!!你知道吗
您可以首先通过} 并计算^{} (如果值是
[::-1]
更改顺序,然后查找^{True
):计算秒数:
每次交付失败时复制累积值,并填充任何之前的值:
直到失败的秒数只是两者之间的区别:
相关问题 更多 >
编程相关推荐