Need help with efficient python code(using pandas) to find which vehicle at what time passed closest to incident_sw =(35.7158, -120.7640). I'm having trouble formulating a Euclidean distance to sort through below df and print which vehicle and its corresponding time are closest to incident_sw. All times are HH:MM:SS.SS (assume below times are hour 12).
My time conversion function--
def time_convert(str_time):
values = str_time.split(':')
mins = 60*(float(values[0]) - 12) + float(values[1]) + 1.0/60 * float(values[2])
mins = round(mins, 4)
return mins
My csv dataframe--
vehicle time lat[D.DDD] lon[D.DDD]
veh_1 17:19.5 35.7167809 -120.7645652
veh_1 17:19.5 35.7167808 -120.7645652
veh_1 17:19.7 35.7167811 -120.7645648
veh_1 17:20.1 35.7167812 -120.7645652
veh_2 17:20.4 35.7167813 -120.7645647
veh_2 17:20.7 35.7167813 -120.7645646
veh_3 17:22.6 35.7167807 -120.7645651
veh_3 17:23.4 35.7167808 -120.7645652
veh_4 17:24.1 35.7167803 -120.7645653
veh_4 17:25.0 35.7167806 -120.7645658
veh_5 17:25.9 35.7167798 -120.7645659
veh_5 17:26.6 35.7167799 -120.7645658