title: Iterating through rows in Pandas
body: <p>I am having an issue applying some maths to my dataframe</p>
  <p>Current df:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">name</th>
  <th style="text-align: center;">lastConnected</th>
  <th style="text-align: right;">check</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">test1</td>
  <td style="text-align: center;">1647609274746</td>
  <td style="text-align: right;">Connection</td>
  </tr>
  <tr>
  <td style="text-align: left;">test2</td>
  <td style="text-align: center;">1647609274785</td>
  <td style="text-align: right;">Connection</td>
  </tr>
  <tr>
  <td style="text-align: left;">test3</td>
  <td style="text-align: center;">1647000000000</td>
  <td style="text-align: right;">Connection</td>
  </tr>
  <tr>
  <td style="text-align: left;">test4</td>
  <td style="text-align: center;">1647609274756</td>
  <td style="text-align: right;">Connection</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Desired df: i now want to create a new column and check if server is still online</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">name</th>
  <th style="text-align: center;">lastConnected</th>
  <th style="text-align: right;">check</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">test1</td>
  <td style="text-align: center;">1647609274746</td>
  <td style="text-align: right;">Connection</td>
  </tr>
  <tr>
  <td style="text-align: left;">test2</td>
  <td style="text-align: center;">1647609274785</td>
  <td style="text-align: right;">Connection</td>
  </tr>
  <tr>
  <td style="text-align: left;">test3</td>
  <td style="text-align: center;">1647000000000</td>
  <td style="text-align: right;">No connection</td>
  </tr>
  <tr>
  <td style="text-align: left;">test4</td>
  <td style="text-align: center;">1647609274756</td>
  <td style="text-align: right;">Connection</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>current code:</p>
  <pre><code>def checkServer():
          for index, row in df.iterrows():
                  timeNow = int((time.time_ns) // 1000000)
                  lastSeenTime = row['lastConnected']
                  timeDifference = currentTime - lastSeenTime
                  if timeDifference &gt; 5000:
                          df['check'] = &quot;No connection&quot;
                  else:
                          df['check'] = &quot;Connection&quot;
          return df
  </code></pre>
  <p>My issue:</p>
  <p>As you can see in my current dataframe it gives Connection to them all even though test3 should have No connection. From my troubleshooting, i printed the  timeDifference into each row and i got the same time difference even though its all got different times. As a result I think my for loop might be the issue.</p>
  <p>Use this site to get current time in miliseconds:  currentmillis.com</p>
  <p>Where am I going wrong?</p>