title: assign a number to every n consecutive dates in pandas
body: <p>I have a dataframe as below:</p>
  
  <pre><code>df = pd.DataFrame( {'date': ['2019-12-22', '2019-12-22','2019-12-15','2019-12-15', 
                               '2019-12-08', '2019-12-08','2019-12-01', '2019-12-01',
                              '2019-11-24', '2019-11-24','2019-11-17', '2019-11-17',
                               '2019-11-10', '2019-11-10'],
                      'name':  ['A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B']})
  </code></pre>
  
  <p>What I want to do is to assign a tag (number) to every two consecutive dates, from the most recent dates. Need result like below:</p>
  
  <pre><code>    date    name    tag
  0   2019-12-22  A   1
  1   2019-12-22  B   1
  2   2019-12-15  A   1
  3   2019-12-15  B   1
  4   2019-12-08  A   2
  5   2019-12-08  B   2
  6   2019-12-01  A   2
  7   2019-12-01  B   2
  8   2019-11-24  A   3
  9   2019-11-24  B   3
  10  2019-11-17  A   3
  11  2019-11-17  B   3
  12  2019-11-10  A   4
  13  2019-11-10  B   4
  </code></pre>
  
  <p>what is the best way to achieve that? need general solution that can apply to n consecutive dates. </p>