I have trouble with my project to make a recommendation list for landmarks. So I have a database like a graph below and I iterate function over. What I don't understand is how to perform an iteration over function from an input (sys.arg(v)) into the data frame??. Thanks for the answer.
The Function :
def haversine(lon1,lat1,lon2,lat2):
lon1, lat1, lon2, lat2 = map(radians, [lon1,lat1,lon2,lat2])
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon2/2)**2
c = 2 * arcsin(sqrt(a))
km = 6367 * c
return km
The function above is returning a distance between two geospatial data.
The Graph or Database :
The input(sys.arg(v)) is passing a location, and the output is list with sorted nearest distance.