title: Create a new column evaluating values in different rows
body: <p>Starting from an imported df from excel like that:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Code</th>
  <th>Time</th>
  <th>Rev</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>AAA</td>
  <td>5</td>
  <td>3</td>
  </tr>
  <tr>
  <td>AAA</td>
  <td>3</td>
  <td>2</td>
  </tr>
  <tr>
  <td>AAA</td>
  <td>6</td>
  <td>1</td>
  </tr>
  <tr>
  <td>BBB</td>
  <td>10</td>
  <td>2</td>
  </tr>
  <tr>
  <td>BBB</td>
  <td>5</td>
  <td>1</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I want to add a new column like that evidence the last revision:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Code</th>
  <th>Time</th>
  <th>Rev</th>
  <th>Last</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>AAA</td>
  <td>5</td>
  <td>3</td>
  <td>OK</td>
  </tr>
  <tr>
  <td>AAA</td>
  <td>3</td>
  <td>2</td>
  <td>NOK</td>
  </tr>
  <tr>
  <td>AAA</td>
  <td>6</td>
  <td>1</td>
  <td>NOK</td>
  </tr>
  <tr>
  <td>BBB</td>
  <td>10</td>
  <td>2</td>
  <td>OK</td>
  </tr>
  <tr>
  <td>BBB</td>
  <td>5</td>
  <td>1</td>
  <td>NOK</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>The df is already sorted by 'Code' and 'Rev'</p>
  <pre><code>df= df.sort_values(['Code', 'Rev'],
           ascending = [True,False])
  </code></pre>
  <p>I thought to evaluate the column 'Code', if the value in column Code is equal to the value in upper row I must have NOK in the new column.</p>
  <p>Unfortunately, I am not able to write it in python</p>