title: Check for matching values in columns- python/pandas
body: <p>I have a CSV file with Lat and long values of two models (Model 1 and Model 2) as shown below. I am trying to achieve following</p>
  <ul>
  <li>Search the first row <code>Lat/ Long</code> values of <code>model 1</code> in every row of <code>model 2</code> columns <code>Lat/ Long</code> values. If the Lat/ Long values of model 1 are found in model 2 then, print their respective area name such as 'Papa' in the new column. The process is repeated for the rest of the rows in model 1 and then will model 2.</li>
  <li>If the <code>Lat/Long</code> values of model 1 didn't match with model 2, then print <code>NOT matched</code> in the output.``</li>
  </ul>
  <p><strong>Minimal working example:</strong></p>
  <pre><code>import pandas as pd
  
  df3= pd.read_csv(&quot;compare.csv&quot;)
  Output=df3.loc[:, df3.columns.isin(list('LatLong'))]
  </code></pre>
  <p>Searched for the existing answers (<a href="https://stackoverflow.com/questions/57294292/python-pandas-get-results-from-searching-two-columns">1</a>), (<a href="https://stackoverflow.com/questions/41773044/search-for-matching-values-in-two-columns-using-pandas">2</a>) but could not found the solution.</p>
  <h2><code>sample_data.csv</code></h2>
  <pre class="lang-py prettyprint-override"><code>Model 1                         Model 2     
  Lat            Lon        Name        X        Y
  -33.348652  138.751659  Kastan  -41.735983  145.532112
  -41.735983  145.532112  Ldon    -37.222005  145.921452
  -37.222005  145.921452  Papa    -33.348652  138.751659
  -37.222005  145.921452  tine    -34.779284  138.522352
  -37.222005  145.921452  Farm    -31.543177  118.4565685
  -27.112811  150.904878  Loy     -38.2536    146.574569
  </code></pre>
  <p><a href="https://i.stack.imgur.com/B8Sf7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B8Sf7.png" alt="enter image description here" /></a></p>