title: Generate a row number for each entry in a pandas grouped dataframe when all rows in each group are the same
body: <p>I have a data frame:</p>
  
  <pre><code>Test = pd.DataFrame([['US','CA', 'Los Angles', 10], ['US','IL', 'Springfield', 20]], 
           columns = ['country', 'state', 'city', 'counter'])
  </code></pre>
  
  <p>I want to repeat each row the number of times that is in the counter so I use <code>numpy</code>.</p>
  
  <pre><code>pet = pd.DataFrame(np.repeat(Test.values, Test['counter'].values, axis = 0), columns = Test.columns)
  </code></pre>
  
  <p>now how do I add a row number to each group?
  So it should run <code>0 to 9</code> for Los Angles and <code>0 - 19</code> for Springfield </p>
  
  <pre><code>Result = pet.groupby(['country', 'state', 'city'])
  Result['row_number'] = ??
  </code></pre>
  
  <p>I tried group by and saw examples of using rank but I don't think that works given that all my rows are the same?</p>