title: Python CSV Reader - Compare Each Row with Each Other Row Within One Column
body: <p>I want to compare each row of a CSV file with itself and every other row within a column. <br>For example, if the column values are like this:</p>
  
  <p>Value_1<br>
  Value_2<br>
  Value_3</p>
  
  <p>The code should pick Value_1 and compare it with Value_1 (yes, with itself too), Value_2 and then with Value_3. Then it should pick up Value_2 and compare it with Value_1, Value_2, Value_3, and so on.</p>
  
  <p>I've written following code for this purpose:</p>
  
  <pre><code>csvfile = "c:\temp\temp.csv"
  with open(csvfile, newline='') as f:
      reader = csv.reader(f, delimiter=',')
      for row in reader:
          for compare_row in reader:
              if row == compare_row
                  print(row,'is equal to',compare_row)
              else:
                  print(row,'is not equal to',compare_row)
  </code></pre>
  
  <p>The code gives the following output:</p>
  
  <pre><code>['Value_1'] is not equal to ['Value_2']
  ['Value_1'] is not equal to ['Value_3']
  </code></pre>
  
  <p>The code compares Value_1 to Value_2 and Value_3 and then stops. Loop 1 does not pick Value_2, and Value_3. In short, the first loop appears to iterate over only the first row of the CSV file before stopping.</p>
  
  <p>Also, I can't compare Value_1 to itself using this code. Any suggestions for the solution?</p>