title: Calculate previous row within distinct groups
body: <p>For every person and change in fruit, how could I create a boolean which works out if for that person and group the purchased column has been filled at some point above</p>
  <pre><code>df
     person  fruit    purchased  time     has_purchased_already_filled_in_for_the_group
  0  amy     apple     stall     10:00    False (this is start of new group so nothing above)
  1  amy     apple     counter   10:01    True (because stall been filled at 10:00)
  2  amy     apple     store     10:01    True  (because stall and counter been filled above)
  3  amy     banana    online    10:02    False (this is start of new group so nothing above)
  4  amy     banana              10:03    True (because online filled)
  5  amy     apple               10:04    True  (this is start of new group so nothing above)        
  6  amy     apple   inperson    10:05    False (because the 10.04 apple purchase is not filled in)
  7  ben  ...
  
  </code></pre>
  <p>I'm struggling how to tell Python that the beginning and end apple group is distinct because bananas was bought in between</p>