I need to calculate distances between two data points ((lat1,lon1) and (lat2,lon2)).
I found a way how to do it here:
import geopy.distance
coords_1 = (52.2296756, 21.0122287)
coords_2 = (52.406374, 16.9251681)
print geopy.distance.vincenty(coords_1, coords_2).km
As a result I need to convert latitude and longitude to one column I found a way here, however, it takes to much time.
df["point1"] = df[["lon1", "lat1"]].apply(Point, axis=1)
df["point2"] = df[["lon2", "lat2"]].apply(Point, axis=1)
Is there a faster solution?