在Python中查找两个gps点之间的距离

时间:2016-08-22 16:15:01

标签: python pandas dataframe

我有以下方法(hasrsine)返回两个gps点之间的距离。下表是我的数据框。

当我在数据框上使用该函数时,我收到错误“无法将系列转换为”。不确定我是否遗漏了什么。任何帮助将不胜感激。

SELECT T1.ID, T1.IP, T2.user, MAX (T2.Login) AS Ultimo_Timestamp, T1.timestamp FROM Table2 T2, Table1 T1
WHERE T2.IP = T1.IP
AND T2.Login < T1.timestamp
GROUP BY T1.ID, T1.IP, T2.user, T1.timestamp
ORDER BY T1.ID;

数据帧:

 distdf1['distance'] = distdf1.apply(lambda x: haversine(distdf1['SLongitude'], distdf1['SLatitude'], distdf1['ClosestLong'], distdf1['ClosestLat']), axis=1) 

方法:

SLongitude  SLatitude   ClosestLong ClosestLat
0   -100.248093 25.756313   -98.220240  26.189491
1   -77.441536  38.991512   -77.481600  38.748722
2   -72.376370  40.898690   -73.662870  41.025640

1 个答案:

答案 0 :(得分:0)

尝试:

set