使用另一个时间戳数据帧来过滤pandas上的时间戳数据帧

时间:2018-04-03 05:23:00

标签: python pandas timestamp

我的主要数据框df

Id  timestamp
265 2017-05-22 02:57:29
267 2017-05-22 04:35:18
279 2017-05-22 11:08:14
281 2017-05-22 11:39:39
282 2017-05-22 11:40:42
285 2017-05-22 11:52:48
288 2017-05-22 12:00:29

我的过滤器数据框df2

Id  timestamp
283 2017-05-22 11:46:55
284 2017-05-22 11:51:41
286 2017-05-22 11:58:20

通常我做了

df[(df['timestamp'] >= '2017-05-22 11:46:55') & (df['dt'] =< '2017-05-22 11:58:20')]

但是,这不是生产友好的,而且重现性较差

1 个答案:

答案 0 :(得分:1)

min max和[{1}}的{​​{1}}日期时间使用between

df2
相关问题