I have a series of timestamps called dates
that look as such:
1 2021-04-21 09:34:00+00:00
2 2021-04-21 10:30:02+00:00
3 2021-04-21 15:54:00+00:00
4 2021-04-22 18:33:57+00:00
5 2021-04-23 18:48:04+00:00
I am trying to find the closest date from another series called PublishTime
which has minutely data for a 6 day time period covering some of the timestamps. The date must be after the timestamp and cannot be before. An example looks as such:
0 2021-04-21 09:30:00
1 2021-04-21 09:31:00
2 2021-04-21 09:32:00
3 2021-04-21 09:33:00
4 2021-04-21 09:34:00
Is there an easy way to quickly find the closest date? I have looked in the datetime
module but cannot find an answer.
EDIT I incorrectly said that the date column covers all the timestamps. In the second series that I am trying to match it to, there is no minute data for weekends and non-business hours, therefore I would like to find the closest date AFTER the timestamp, not before.