Python Forum
How to get indices of minimum time difference
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get indices of minimum time difference
#1
Hi,
I have below data:
df1:
time1 time2
2020/11/05 20:30:23 2020/11/05 20:20:23
2020/11/05 20:40:12 2020/11/05 20:20:23
2020/11/05 20:49:53 2020/11/05 20:20:23
2020/11/05 20:56:28 2020/11/05 20:20:23

df2:

time
2020/11/05 20:36:23

I want to get df1 row indices (1) time2 > time, 2. time1 should be close (minimum difference).

How to get this.

I can only filter

df1_filter = df1[df1['time1'] < df2['time'], but after this I sruck how to get match the (1) time2 > time, 2. time1 should be close (minimum difference).

Please kindly someone help,
Reply


Messages In This Thread
How to get indices of minimum time difference - by Mekala - Nov-09-2020, 03:06 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  time difference bettwenn logs enkliy 14 1,002 Nov-21-2023, 04:51 PM
Last Post: rob101
  Hard time trying to figure out the difference between two strings carecavoador 2 683 Aug-16-2023, 04:53 PM
Last Post: carecavoador
  Sum up Time difference tester_V 10 2,581 Apr-06-2023, 06:54 AM
Last Post: Gribouillis
  "TypeError: string indices must be integers, not 'str'" while not using any indices bul1t 2 2,043 Feb-11-2023, 07:03 PM
Last Post: deanhystad
  How to get index of minimum element between 3 & 8 in list Mekala 2 2,537 Nov-10-2020, 12:56 PM
Last Post: DeaD_EyE
  How to calculate time difference between each row of dataframe in seconds Mekala 1 2,582 Jul-16-2020, 12:57 PM
Last Post: Larz60+
  Finding MINIMUM number in a random list is not working Mona 5 3,053 Nov-18-2019, 07:27 PM
Last Post: ThomasL
  Delete minimum occurence in a string RavCOder 10 3,959 Nov-12-2019, 01:08 PM
Last Post: RavCOder
  Minimum size Amniote 8 3,840 Jul-10-2019, 02:58 PM
Last Post: nilamo
  Correlation of Incidents using time difference Rajhesh 1 1,836 Jun-27-2019, 03:44 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020