I am trying to calculate distances between around 1.4 Millions points stored in a Dataframe with LATITUDE and LONGITUDE in separate columns and a small set of hotspots (around 10 points), also with latitude and longitude, but it is taking a while.
I try the code below:
from geopy import distance
import pandas as pd
def distance_rows(start, points):
return min([distance(start, stop).km for stop in points])
df['distance'] = df.apply(lambda row: distance_rows((row.LATITUDE, row.LONGITUDE), points), axis=1)
df is my dataframe, distance_rows receive the point and a list of around 10 points and return the minimum distance from start to each point in points.
It is taking a while to complete do you know a fast way to calculated the distance between millions of points and some points of interest using python?
I apologize for my English...