title: Count consecutive same numbers in a Dataframe
body: <p>I'm trying to count the consecutive same values in this Dataframe below:</p>
  <p><img src="https://i.stack.imgur.com/CO6Y6.png" alt="Dataframe" /></p>
  <p>DF:</p>
  <pre><code>{'obligacion': {0: 200000000123,  1: 200000000123,  2: 200000000123,  3: 200000000123,  4: 00000000123,  5: 200000000123,  6: 200000000123,  7: 200000000123,  8: 200000000123,  9: 200000000123,  0: 200000000123,  11: 200000000123,  12: 200000000123,  13: 200000000123,  14: 200000000123,  15: 00000000123,  16: 200000000123,  17: 200000000123}, 0: {0: 'mora18',  1: 'mora17',  2: 'mora16',  3: mora15',  4: 'mora14',  5: 'mora13',  6: 'mora12',  7: 'mora11',  8: 'mora10',  9: 'mora9',  10: 'mora8',  1: 'mora7',  12: 'mora6',  13: 'mora5',  14: 'mora4',  15: 'mora3',  16: 'mora2',  17: 'mora1'}, dias_mora': {0: '-1',  1: '-1',  2: '-1',  3: '-1',  4: '-1',  5: '-1',  6: '-1',  7: '4',  8: '6',  9: 0',  10: '8',  11: '9',  12: '7',  13: '10',  14: '3',  15: '2',  16: '3',  17: '2'}}
  </code></pre>
  <p>So I want as the output something like this:</p>
  <p>[200000000123: (-1, 7),
  (4, 1),
  (6, 1),
  (0, 1),
  (8, 1),
  (9, 1),
  (7, 1),
  (10, 1),
  (3, 1),
  (2, 1),
  (3, 1),
  (2, 1)]</p>
  <p>The ID number followed by the consecutive count of the numbers, example:</p>
  <p><strong>The number -1 repeats 7 consecutive times</strong></p>
  <p>---------------UPDATE------------------</p>
  <p>CODE USED</p>
  <pre><code>import pandas as pd 
  data = {
   'obligacion': [200000000123, 200000000123, 200000000123, 200000000123, 200000000123, 200000000123, 200000000123, 200000000123, 200000000123, 200000000123, 200000000123, 200000000123, 200000000123, 200000000123, 200000000123, 200000000123, 200000000123, 200000000123] +
                 [200000000444, 200000000444, 200000000444, 200000000444, 200000000444, 200000000444, 200000000444, 200000000444, 200000000444, 200000000444, 200000000444, 200000000444, 200000000444, 200000000444, 200000000444, 200000000444, 200000000444, 200000000444],
   '0': [ 'mora18', 'mora17', 'mora16', 'mora15', 'mora14', 'mora13', 'mora12', 'mora11', 'mora10', 'mora9', 'mora8', 'mora7', 'mora6', 'mora5', 'mora4', 'mora3', 'mora2', 'mora1'] +
        [ 'kiwi18', 'kiwi17', 'kiwi16', 'kiwi15', 'kiwi14', 'kiwi13', 'kiwi12', 'kiwi11', 'kiwi10', 'kiwi9', 'kiwi8', 'kiwi7', 'kiwi6', 'kiwi5', 'kiwi4', 'kiwi3', 'kiwi2', 'kiwi1'], 
   'dias_mora': [ '-1', '-1', '-1', '-1', '-1', '-1', '-1', '4', '6', '0', '8', '9', '7', '10', '3', '2', '3', '2'] +
                [ '12', '0', '4', '4', '4', '7', '10', '4', '-6', '-7', '8', '8', '17', '10', '10', '-2', '3', '2']
  }
  
  df = pd.DataFrame.from_dict(data)  # convert dictionary to dataframe
  
  dict_count = {}
  for nid in df.obligacion.unique():
      vector_mora = df['dias_mora'][df.obligacion == nid].values
      groups = groupby(vector_mora)
      result = [(label, sum(1 for _ in group)) for label, group in groups] 
      dict_count[nid] = result
  dict_count
  </code></pre>