title: Iterate through a pandas dataframe to get a specific output
body: <p>I have a dataframe which I want to iterate to get a specific result.</p>
  <p>Portion of the dataframe df (the name of the columns are <code>guid1</code> and <code>guid2</code>) :
  <a href="https://i.stack.imgur.com/uYMGP.png" rel="nofollow noreferrer">DataSet</a></p>
  <pre><code> guid1  guid2
   A865   OR4
   A875   OR4
   OR4    JN1397
   JN1400 JN1401
   JN1402 DEL131KS-
   Unset  AND1
  </code></pre>
  <p><strong>Interpretation :</strong> Both <code>A865</code> and <code>A875</code> are connected to <code>OR4</code> and <code>OR4</code> is then connected to <code>JN1397</code> (it's a representation of a logical diagram).
  My goal here is to iterate through the dataframe (to verify if there is any connections) to get a string result (as follows) in which I interpret the different connections:</p>
  <pre><code>A865, A875, OR4, JN1397
  </code></pre>
  <p>I already posted this question and it has been closed for lack of clarity, I really hope it's clear enough now because I really need some help here..</p>