我有一个如下所示的数据框:
Timestamp (Index) Status value
2017-01-01 12:01:00 OPEN 83
2017-01-01 12:02:00 OPEN 82
2017-01-01 12:03:00 OPEN 87
2017-01-01 12:04:00 CLOSE 82
2017-01-01 12:05:00 CLOSE 81
2017-01-01 12:06:00 CLOSE 81
2017-01-01 12:07:00 CLOSE 81
2017-01-01 12:08:00 CLOSE 81
2017-01-01 12:09:00 CLOSE 81
2017-01-01 12:10:00 CLOSE 81
2017-01-01 12:11:00 CLOSE 81
2017-01-01 12:12:00 OPEN 81
2017-01-01 12:13:00 OPEN 81
2017-01-01 12:14:00 OPEN 81
2017-01-01 12:15:00 OPEN 81
2017-01-01 12:16:00 CLEAR 34
2017-01-01 12:17:00 CLOSE 23
2017-01-01 12:18:00 CLOSE 23
2017-01-01 12:19:00 CLOSE 75
2017-01-01 12:20:00 CLOSE 65
2017-01-01 12:21:00 CLOSE 72
2017-01-01 12:22:00 CLOSE 76
2017-01-01 12:23:00 CLOSE 77
2017-01-01 12:24:00 OPEN 87
2017-01-01 12:25:00 OPEN 87
2017-01-01 12:26:00 OPEN 87
2017-01-01 12:27:00 OPEN 87
2017-01-01 12:28:00 OPEN 87
2017-01-01 12:29:00 CLOSE 75
2017-01-01 12:30:00 CLOSE 75
2017-01-01 12:31:00 CLOSE 75
如果连续关闭值中的第一个低于 70,我想删除之前出现的打开块和值低于 70 的关闭块。它应该如下所示:
Timestamp (Index) Status value
2017-01-01 12:01:00 OPEN 83
2017-01-01 12:02:00 OPEN 82
2017-01-01 12:03:00 OPEN 87
2017-01-01 12:04:00 CLOSE 82
2017-01-01 12:05:00 CLOSE 81
2017-01-01 12:06:00 CLOSE 81
2017-01-01 12:07:00 CLOSE 81
2017-01-01 12:08:00 CLOSE 81
2017-01-01 12:09:00 CLOSE 81
2017-01-01 12:10:00 CLOSE 81
2017-01-01 12:11:00 CLOSE 81
2017-01-01 12:24:00 OPEN 87
2017-01-01 12:25:00 OPEN 87
2017-01-01 12:26:00 OPEN 87
2017-01-01 12:27:00 OPEN 87
2017-01-01 12:28:00 OPEN 87
2017-01-01 12:29:00 CLOSE 75
2017-01-01 12:30:00 CLOSE 75
2017-01-01 12:31:00 CLOSE 75
关于如何获取相关时间戳以删除这些时间段的任何想法?
慕标5832272
相关分类