-1

I am trying to write a code where I am creating a haversine function to calculate the distance of a dataset containing different properties from the nearest hospital using their geolocation and this is what my code looks like:

code snippet

However, I get this error which I don't understand as I am using lat2 and ids and have defined it whilst creating the function.

Could someone help me understand the error and probably, fix it too?

hospital dataframe

property details

khelwood
  • 55,782
  • 14
  • 81
  • 108
  • See [Why not upload images of code/errors when asking a question?](//meta.stackoverflow.com/q/285551) – khelwood Nov 18 '20 at 18:00

1 Answers1

0

haversine_hospital expects 5 inputs: lon1, lat1, lon2, lat2, ids

You have only given it 3: lat1, lon1, j(ids presumably).

You need to give it the X and Y coordinates of some other target that you want to calculate the distance from.

John Stud
  • 1,506
  • 23
  • 46