title: How to merge two different dataframes content on the condition of two columns in a row matches
body: <p>I have a dataframe1 that contains 1064 records and dataframe2 that contains 328 records in it. I want to merge dataframe2 into dataframe1. the dataframe the rest of the records that doesnt have corresponding data in the second df should get filled in with the text &quot;NA&quot;. for example</p>
  <p>DF1</p>
  <pre><code>Name    Area    Totalcases
  Name1         Area1         200
  Name2         Area2         300
  Name3         Area2         100
  Name3         Area3         0
  </code></pre>
  <p>DF2</p>
  <pre><code>Name    Area    Seriouscases     Othercases
  Name1         Area1         50         150
  Name2         Area2         100        200
  Name3         Area2         150         150
  </code></pre>
  <p>Desired Output</p>
  <pre><code>Name    Area    Totalcases    Seriouscase    Othercases
  Name1   Area1         200         50         150
  Name2   Area2         300         100        200
  Name3   Area2         100         150         150
  Name3   Area3         0           NA          NA
  </code></pre>
  <p>I used the following command to get the job done</p>
  <pre><code>df = pd.merge(readCSV1, readCSV2, on=['Name', 'Area'], how='left').fillna(method='ffill')
  </code></pre>
  <p>But the issue I face is that the often there are several similar names in the name column and often even if there is no corresponding data in the second file the data of a similar name get filled in. How to make sure that data gets merged only if both name and area is matched the corresponding data gets merged or if data not available in 2nd df to be filled in with &quot;NA&quot;</p>