title: Excel columns comparison using python code
body: <p>I am working with excel for comparing three columns: my idea is to compare two columns of data with a third column as a array like each value in the 3rd column should be compared with every row of the first and second column and want to extract only those rows where the first and second column's data is present in the third column I used this python command </p>
  
  <pre><code>if([x in x,y for datafile] == [x in x for file) and [y in x,y for datafile] == [x in x for file]): 
      print x,y
  else:
      print none        
  </code></pre>
  
  <p>this gave me an error as syntax error</p>
  
  <p>I have converted my first two columns into a tuple using the <code>zip</code> function the x,y corresponds to the values in the tuple</p>
  
  <pre><code>Col_1 ||  Col_2    ||   file
  Abc   |    Abk     |    cnl
  Nck   |    Nck     |    Abk
  xkl   |    cnl     |    Abc  
  mzn   |    mzn     |  
  </code></pre>
  
  <p>this I have combined as datafile <code>((Abc,Abk),(Nck,Nck),(xkl,cnl),(mzn,mzn))</code></p>
  
  <p>Note: my column 3 has smaller values than col 1&amp;2. I have over 100k values to compare</p>
  
  <p>I want a working python program for this  query </p>
  
  <pre><code>if [x for x,y in mydata if x == genelist and
  y for x,y in mydata if y == genelist]:
      print (x,y)
  else: 
  </code></pre>
  
  <p>can someone correct the syntax error in the above code here </p>
  
  <pre><code>mydata('gene1,genea','gene2,geneb''gene3,genec') and genelist ('genea','geneb','genec') 
  </code></pre>
  
  <p>when I use the code without if statement it prints me "[]" I don't know what's wrong here </p>