title: recount group if out of sequence
body: <p>I have a dataframe:</p>
  <pre><code>df = pd.DataFrame({&quot;jumps&quot;:[1,2,3,4,3,2,1,2,3,1,1,4,4],
                     &quot;Location&quot;:['US','US','US','US','US','US','US','US','US','FR','FR','US','US'], 
                     &quot;job&quot;:[&quot;sales&quot;,&quot;sales&quot;,&quot;sales&quot;,&quot;marketing&quot;,&quot;marketing&quot;,&quot;sales&quot;,&quot;sales&quot;,&quot;sales&quot;,&quot;sales&quot;,&quot;IT&quot;,&quot;IT&quot;,&quot;marketing&quot;,&quot;marketing&quot;]})
  </code></pre>
  <p>result:</p>
  <pre><code>jumps   Location    job
  0   1   US          sales
  1   2   US          sales
  2   3   US          sales
  3   4   US          marketing
  4   3   US          marketing
  5   2   US          sales
  6   1   US          sales
  7   2   US          sales
  8   3   US          sales
  9   1   FR          IT
  10  1   FR          IT
  11  4   US          marketing
  12  4   US          marketing
  </code></pre>
  <p>what I wish to do is to group by job based on occurrence. So if the job description is out of sequence - it must be count again. A simple group by job will aggregate sales in the first group and the later group (index 5 to 8).</p>
  <p>What I wish to have is the index of the first occurrence:</p>
  <pre><code>sales 0
  marketing 3
  sales 5
  IT 9
  marketing 11
  </code></pre>