title: Creating a new column based on the element of next row of existing column
body: <p>I am working on cleaning up and re-structured the data frame.</p>
  
  <p>I have the following dataframe:</p>
  
  <pre><code>data= pd.DataFrame()
  data['ID'] = [1,1,1,1,1,2,2,2,2,2]
  data ['EventSecond'] = [1.5,2,2.5,3,3.8,4,4.8,6,7,8,]
  data ['P1'] = ['A','B','C','D','E','F','A','D','E','G']
  data ['Code'] = [12,13,16,9,9,0,4,13,14,16]
  data ['status'] =['Pass','Pass','Pass','Pass','Pass','Pass','shot','shot','Pass','Pass']
  data ['Accuracy']= ['Accurate','Accurate','Accurate','Accurate','Accurate','Not Accurate','Accurate','Accurate','Accurate','Not Accurate']
  </code></pre>
  
  <p>In this data frame, I have ID, Eventsecond etc.
  What I want to do is to create a new column <strong>P2</strong> that contains the element of next row of column P1 if the element of column <strong>Accuracy</strong>  is <strong>Accurate</strong>. One thing is if the ID column below is different, I wont take the element from below row and just leave it blank
  If the Accuracy is <strong>Not Accurate</strong>, I will leave blank for this row.</p>
  
  <p><strong>Supplement to the question</strong></p>
  
  <p>I will only take the rows where the status column has value of <strong>Pass</strong>.</p>
  
  <p>The expected output from this is as follow:</p>
  
  <p><a href="https://i.stack.imgur.com/Kw09Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Kw09Z.png" alt="enter image description here"></a></p>
  
  <p>Can anyone advise on it?
  Thanks,</p>
  
  <p>Zep.</p>