title: How to find the distance between 2 points in 2 different dataframes in pandas?
body: <p>I've got two dataframes, each with a set of coordinates. <code>Dataframe 1</code> is a list of biomass sites, with coordinates in columns 'lat' and 'lng'. <code>Dataframe 2</code> is a list of postcode coordinates, linked to sale price, with coordinates in columns 'pc_lat' and 'pc_lng'.</p>
  
  <p>I've used <a href="https://stackoverflow.com/questions/36843122/how-to-find-the-closest-match-based-on-2-keys-from-one-dataframe-to-another">this stackoverflow question</a> to work out the closest biomass site to each property. This is the code I am using:</p>
  
  <pre><code>def dist(lat1, long1, lat2, long2):
  return np.abs((lat1-lat2)+(long1-long2))
  
  def find_site(lat, long):
      distances = biomass.apply(
          lambda row: dist(lat, long, row['lat'], row['lng']), 
          axis=1)
      return biomass.loc[distances.idxmin(),'Site Name']
  
  hp1995['BiomassSite'] = hp1995.apply(
      lambda row: find_site(row['pc_lat'], row['pc_long']), 
      axis=1)
  
  print(hp1995.head())
  </code></pre>
  
  <p>This has worked well, in that I've got the name of the closest Biomass generation site, however I want to know the distance calculated between these two sites. </p>
  
  <ol>
  <li><p>How would I calculate the distance?</p></li>
  <li><p>What metric would the output distance be in? I am trying to find properties within 2km from the biomass site. </p></li>
  </ol>