title: How do I compare value from one row against all other rows?
body: <p>I want to compare every single row against all other rows in pandas.</p>
  
  <p>Having this DataFrame:</p>
  
  <pre><code>index     entity
  
  a           1
              2
              3
  
  b           3
              3
              9
  
  c           10
              0
              1
  
  d           9
              3
              0
  </code></pre>
  
  <p>I want a match on:</p>
  
  <p><code>[0,1], [0,2], [0,3]</code> <em>(these are indexes)</em> because 1,2,3 <em>(these are values in a column)</em> exists in every column. Also, how can I actually count repetitive matches? Example, index A finds a pair with all values (one, two, three), index C only with 1 value (zero).</p>
  
  <p>I understand I need to hold row with index A in variable, and then compare it against all other rows in a loop. After this done, I move to row with index B and repeat this action for every other row, including row with index A.</p>
  
  <p>How do I hold one row in memory and check it against all other rows?</p>
  
  <p>Output can be in format of a list [0,1], [0,2], where numbers are indexes.</p>
  
  <p>That's sort of pseudo-code I have right now in mind:</p>
  
  <pre><code>var = [x for x in e_dataframe.entity]
  
  for rows in e_dataframe.entity:
      for x in var:
          if x == rows:
              print('match', x, ' and ', rows)
          else:
              print('not match ', x , ' and ', rows)
  </code></pre>
  
  <p>Where <code>entity</code> what be our column with numerical values above.</p>
  
  <p>Of course this is wrong, i don't match anything. I somehow cannot wrap my head around writing this loop.</p>