title: Compare two CSV file and update one CSV file based on compared result using Python
body: <p>I'm new to Python and written this code to compare two CSV file. The idea is:
  my 1st CSV file has only one column:</p>
  
  <p>1st CSV </p>
  
  <pre><code>    ColA
      ----
  
       A
       B
       C
  </code></pre>
  
  <p>My 2nd CSV file is like:</p>
  
  <pre><code>     Country    ColA  ColB
       -------------------------
        US          A
       Ind          B      
                    C     AU K-
  </code></pre>
  
  <p>What I wanted is, if any record of ColA of 1st CSV file matches with ColA of 2nd CSV file
  then, I want to parse ColB's "AU K-" value to get only "AU" and update in the country of the 2nd CSV file. and my output should look like this:</p>
  
  <p>So, my 2nd CSV file/Output file will look like:</p>
  
  <pre><code>  Country    ColA  ColB
     ---------------------
     US           A
     Ind          B      
     AU           C     
  </code></pre>
  
  <p>The following code is written to find the match: However, I'm not getting the output in the console while testing. The console simply appears and disappears.</p>
  
  <p>How to retain the console so that I can read the matches? Also, how to update the 2nd CSV if the values matched?</p>
  
  <p>Below is my code sample how I' doing this:</p>
  
  <pre><code>import pandas
   with open('D:\Project\SourceFile.csv') as f:
  r = pandas.read_csv(f)
  with open('D:\Project\Searchfile.csv','r') as w:
  x = pandas.read_csv(w)
  
  col = w['ColA']
  for line in w:
      for col in w:
          for row in r:
              if row in col:
                  print(line)
  </code></pre>
  
  <p>Note: I'm using IronPython on VS 2015 with Win7 64Bit. Using IronPython as I would like to integrate few things with .Net code.However, I'm open for any normal/default Python tool.</p>
  
  <p>It looks like IronPython or Python on Windows is somehow not reading CSV file: I referred this (<a href="http://pythonhow.com/data-analysis-with-python-pandas/" rel="nofollow noreferrer">http://pythonhow.com/data-analysis-with-python-pandas/</a> ) just to test, however, nothing is showing up..Not sure why? Checked environment variables and Python folder, DLLs and Libs are added. What am I doing wrong?
  Hope I explained it correctly.</p>
  
  <p>Please suggest. Thanks.</p>