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
#2
The first thing you need to do is extract the datetime strings from the lines. Can you do that?

To determine the shortest duration between the two times you need to convert them to something you can subtract. Any units will do, hours, days, seconds, as long as both times are converted to the same time unit. Even a datetime object will work. Can you do this?

The last part is the easiest. Calculate the duration for each line and keep track of the shortest duration.
Reply


Messages In This Thread
RE: How to get indices of minimum time difference - by deanhystad - Nov-10-2020, 11:09 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Is there a difference between Python’s time.sleep and win32api.Sleep? phpjunkie 4 1,034 Sep-21-2024, 05:17 PM
Last Post: aakritiintelligence
  time difference bettwenn logs enkliy 14 3,332 Nov-21-2023, 04:51 PM
Last Post: rob101
  Hard time trying to figure out the difference between two strings carecavoador 2 1,378 Aug-16-2023, 04:53 PM
Last Post: carecavoador
  Sum up Time difference tester_V 10 6,830 Apr-06-2023, 06:54 AM
Last Post: Gribouillis
  "TypeError: string indices must be integers, not 'str'" while not using any indices bul1t 2 5,628 Feb-11-2023, 07:03 PM
Last Post: deanhystad
  How to get index of minimum element between 3 & 8 in list Mekala 2 3,170 Nov-10-2020, 12:56 PM
Last Post: DeaD_EyE
  How to calculate time difference between each row of dataframe in seconds Mekala 1 3,542 Jul-16-2020, 12:57 PM
Last Post: Larz60+
  Finding MINIMUM number in a random list is not working Mona 5 4,322 Nov-18-2019, 07:27 PM
Last Post: ThomasL
  Delete minimum occurence in a string RavCOder 10 5,728 Nov-12-2019, 01:08 PM
Last Post: RavCOder
  Minimum size Amniote 8 5,302 Jul-10-2019, 02:58 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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