title: pandas compare multiple column values from different frames of different lengths
body: <p>I have a data frame with GPS coordinates and I'm trying to make an offline reverse geocode city lookup service. I'm essentially trying to resolve the city name from a pair of GPS coordinates. I cannot use 3rd party services.</p>
  
  <p>My data frame looks like this:</p>
  
  <pre><code>data = [
      ["LATITUDE","LONGITUDE"],
      [41.9021454,-87.624176],
      [38.8898163,-76.9598312],
      [39.304615,-76.6136703],
      [38.9550285,-76.7441483],
      [41.8815498,-87.6620789],
      [33.9141922,-84.3123169]
  ]
  df = pd.DataFrame(data[1:],columns=data[0])
  
  LATITUDE    LONGITUDE
  41.9021454  -87.624176
  38.8898163  -76.9598312
  39.304615   -76.6136703
  38.9550285  -76.7441483
  41.8815498  -87.6620789
  33.9141922  -84.3123169
  </code></pre>
  
  <p>I made a city lookup data frame</p>
  
  <pre><code>city_data = [
      ['CITY',"LAT","LON"],
      ['PHOENIX',33.0,-112.0],
      ['ATLANTA',33.0,-84.0],
      ['MIAMI',25.0,-80.0],
      ['WASHINGTON_DC',39.0,-77.0],
      ['CHICAGO',41.0,-87.0],
  ]
  df_geo = pd.DataFrame(city_data[1:],columns=city_data[0])
  
              CITY   LAT    LON
  0        PHOENIX  33.0 -112.0
  1        ATLANTA  33.0  -84.0
  2          MIAMI  25.0  -80.0
  3  WASHINGTON_DC  39.0  -77.0
  4        CHICAGO  41.0  -87.0
  </code></pre>
  
  <p>I want to compare the lat and lon of both data frames to see if the values are ~roughly +/- 1 within each other and if so make a new column with the city name like this:</p>
  
  <pre><code>LATITUDE    LONGITUDE   CITY
  41.9021454  -87.624176  CHICAGO
  38.8898163  -76.9598312 WASHINGTON_DC
  39.304615   -76.6136703 WASHINGTON_DC
  38.9550285  -76.7441483 WASHINGTON_DC
  41.8815498  -87.6620789 CHICAGO
  33.9141922  -84.3123169 ATLANTA
  </code></pre>
  
  <p>The data frames are of different lengths. The city lookup might be 10 rows but the data might be thousands. I'm pretty sure the comparison can be done in one line with np.where or df.isin but I don't know how to say it. I have this but I'm stuck</p>
  
  <pre><code>df['city'] = np.where(abs(df['LATITUDE'] - df_geo.loc[df["LAT"]]) &lt;= 1  and
                        abs(df['LONGITUDE'] - df_geo.loc[df["LON"]]) &lt;= 1, df_geo['CITY'], 'TBD')
  
  
  df['city'] = np.where(df['LATITUDE'].round(0) in df_geo['LAT'] and
                        df['LONGITUDE'] in df_geo['LON'] , df_geo['CITY'], 'TBD')
  </code></pre>