我有一个数据框,其中有一列是时间戳。我已使用 pandas to_datetime()方法将该列转换为日期时间对象。但是我想要的是count, for each time stamp, the number of timestamps that fall between this timestamp and prior 15 minutes。
例如:如果时间戳是 (2018,7,6,13,55) [年、月、日、小时、分钟格式],那么我想计算介于该时间戳和时间戳 (2018,7,6,13,40)。
很容易看出需要做什么,但它涉及在数据集上反复来回走动。我有接近 750,000 个数据点,我认为效率不高。
我怎样才能有效地做到这一点?
任何建议/提示将不胜感激。
谢谢。