Skip to content Skip to sidebar Skip to footer

How To Find The Distance Between Two Points Given Longitude And Latitude In Python-error?

I have two locations with longitude and latitude given and I would like to get the distance between these points in python. My data set looks like below: df_TEST = pd.DataFrame({'L

Solution 1:

As seen in the Documentation it accepts float tuple and not a pandas series tuple that you are trying to do here, try this instead:

df_TEST['distance']=geopy.distance.geodesic(( float(df_TEST['Long']), 
 float(df_TEST['Lat'])),(float(df_TEST['Long1']), float(df_TEST['Lat1']))).km

Post a Comment for "How To Find The Distance Between Two Points Given Longitude And Latitude In Python-error?"