【发布时间】:2020-03-27 05:37:07
【问题描述】:
我有一个这样的熊猫数据框(时间戳转换为日期时间对象):
id timestamp
0 221 2020-11-07 12:02:00
1 223 2020-11-08 13:21:00
2 224 2020-11-09 12:50:00
3 225 2020-11-10 14:23:00
4 226 2020-11-11 12:25:00
5 227 2020-11-14 14:26:00
我想查找时间间隔之间的行数。例如 12:00-13:00,这里是 3(条目 0、2 和 4)
【问题讨论】:
-
看起来between_time 会有所帮助
-
这是来自 SO stackoverflow.com/questions/35052691/… 的 between_time 示例
-
你有没有尝试过,做过什么研究?
-
这能回答你的问题吗? Select DataFrame rows between two dates
-
between_time 会起作用。只需将时间戳设置为索引即可。