title: How to Replace a column in a CSV file in Python?
body: <p>I have 2 csv files.  I need to replace a column in one file with a column from the other file but they have to stay sorted according to an ID column.</p>
  
  <p>Here's an example:</p>
  
  <p>file1:                                                     </p>
  
  <pre><code>ID, transect, 90mdist                                      
  1, a, 10,                                                  
  2, b, 20,                                                
  3, c, 30,     
  </code></pre>
  
  <p>file2:                                                       </p>
  
  <pre><code>ID, transect, 90mdist                                
  1, a, 50                                                   
  2, b, 70                                                     
  3, c, 90          
  </code></pre>
  
  <p>basically I created a new file with the correct 90mdist and I need to insert it into the old file but it has to line up with the same ID #.</p>
  
  <p>It's my understanding that Python treats csv files as a string.  so I can either use a dictionary or convert the data into a list and then change it? which way is best?</p>
  
  <p>Any help would be greatly appreciated!! </p>