title: Data in 1st row should be equal to the last row- Using Pandas
body: <p>I have a pandas dataframe with around 15 columns and all i am trying to do is see if the data in 1st row of partition_num is equal to the data in last row of partition_num if its not equal, add a new row at the end with the data from the 1st row</p>
  
  <p>Input:</p>
  
  <pre><code>row   id  partition_num   lat    long    time
   0     1    7333           24     26      9
   1     2    7333           15     19      10
   2     3    7333           24     25      9
   3     1    8999           26     18      15
   4     2    8999           15     17      45
   5     3    8999           26     18      15
   6     1    3455           12     14      18
   7     2    3455           12     14      18
  </code></pre>
  
  <p>Desired output:</p>
  
  <pre><code>row   id  partition_num   lat    long    time
   0     1    7333           24     26      9
   1     2    7333           15     19      10
   2     3    7333           25     26      9
   3     4    7333           24     26      9
   4     1    8999           26     18      15
   5     2    8999           15     17      45
   6     3    8999           26     18      15
   7     1    3455           12     14      18
   8     2    3455           12     14      18
  </code></pre>
  
  <p>Since the data for partition_num -7333 in row 0 is not equal to the data in row 2, add a new row(row 3) with same data as row 0</p>
  
  <p>can we add a new column to identify the new record something like flag :    </p>
  
  <pre><code>row   id  partition_num   lat    long    time   flag  
   0     1    7333           24     26      9      old  
   1     2    7333           15     19      10     old  
   2     3    7333           25     26      9      old  
   3     4    7333           24     26      9      new  
   4     1    8999           26     18      15     old  
   5     2    8999           15     17      45     old  
   6     3    8999           26     18      15     old  
   7     1    3455           12     14      18     old  
   8     2    3455           12     14      18     old  
  </code></pre>