无法将系列转换为<class'float'>

时间:2019-07-10 06:48:17

标签: for-loop coordinates python-3.6 python-3.5 latitude-longitude

我需要找到连续的纬度和经度的距离,并在n行上进行迭代,但是由于TypeError:无法将序列转换为17.5 17.6451619232709 -102.5 -102.786575076482 17.6451619232709 17.7899091408215 -102.786575076482 -103.073611759129 17.7899091408215 17.9342373469752 -103.073611759129 -103.361113499291 17.9342373469752 18.0781422239292 -103.361113499291 -103.649083720155

,它给了我错误

我的数据集采用以下格式:

slat elat slon elon

import pandas as pd
df=pd.read_csv("/home/Documents/outcoords.csv", dtype=float)
from math import radians, sin, cos, acos
slat = df['slat'].tolist()
slon =  df['slon'].tolist()
elat =  df['elat'].tolist()
elon = df['elon'].tolist()
df['distance'] = [6371.01 * acos(sin(slat)*sin(elat) +
cos(slat)*cos(elat)*cos(slon - elon)) for x in range(df.shape[0])]
df

我尝试过的代码如下:

curl -X POST \
https://login.smoobu.com/booking/checkApartmentAvailability \
-H 'Api-Key: xxxxx' \
-H 'cache-control: no-cache' \
-d '{
    "arrivalDate" : "2018-04-01",
    "departureDate":  "2019-12-03",
    "apartments": [126936, 127858, 126937],
    "customerId": 38484
}'

它应该找到连续行的距离并显示该距离。

0 个答案:

没有答案