【发布时间】:2017-09-30 16:44:52
【问题描述】:
我的问题是关于使用 Pandas 时间序列。
我有一个文件(Spots),其中包含一个月数据的熊猫时间序列,范围为 7.5 秒。 示例:
2016-11-01 00:00:00,0
2016-11-01 00:00:07.500000,1
2016-11-01 00:00:15,2
2016-11-01 00:00:22.500000,3
2016-11-01 00:00:30,4
另一个文件(目标)只有时间信息。
例子:
2016-11-01 00:00:05
2016-11-01 00:00:07
2016-11-01 00:00:23
2016-11-01 00:00:25
我想查看目标日期时间属于哪个时间点: 上面例子中的输出:
2016-11-01 00:00:00,0 '\t' count of targets in this spot = 2
2016-11-01 00:00:07.500000,1 '\t' count of targets in this spot = 0
2016-11-01 00:00:15,2 '\t' count of targets in this spot = 0
2016-11-01 00:00:22.500000,3 '\t' count of targets in this spot = 0
2016-11-01 00:00:30,4 '\t' count of targets in this spot = 2
提前非常感谢您。如果这很清楚,请告诉我,否则我可以尝试解释更多。
【问题讨论】:
-
第一行如何在那个位置有 2 个目标?看起来应该是 0。除非您将目标四舍五入到最近的点?更清楚地了解结果背后的逻辑会有所帮助。
标签: python-2.7 pandas data-science