title: sequencing the match week
body: <p>I have a CSV file that contains football results since 2005.
  You can find the data file below link.
  <a href="https://drive.google.com/open?id=1noRBphUam60mpxHB9iZAz2zj7pN8XPsF" rel="nofollow noreferrer">Click here to download the file</a></p>
  
  <p>The shape of df is (23758,24)
  I would like to create a new column that sequence all the match based on the column <strong>Div</strong></p>
  
  <p>Div contains 5 groups such as <strong>E0</strong>,<strong>F1</strong>, <strong>I1</strong>,<strong>SP1</strong>,<strong>D1</strong>.</p>
  
  <p>E0,F1,I1,SP1 contains 380 matches in a year (i.e.date ranges from Aug 2005/ May 2006) whereas D1 contains 306 matches.</p>
  
  <p>The sequencing that I want to do is to number every 10 matches for E0,F1,I1,SP1  and every 9 matches for D1.</p>
  
  <p>That means that the first 10 matches for E0,F1,I1,SP1 will be 1 and the following 10 matches will be 2 etc. Similarly the first 9 matches for D1 will be assigned as 1, the following 9 matches will be assigned as 2 etc.</p>
  
  <p>The number will be restarted if it reaches to 39 for E0,F1,I1,SP1. That means if it hits 39, then it will be assigned as 1 again. </p>
  
  <p>The number will be restarted if it reaches to 35 for D1, it means D1 will only have 1 to 34, E0,F1,I1,SP1  will only have 1 to 38.</p>
  
  <pre><code>df ['GW'] = ((data.groupby('Div').cumcount())/10).astype('int64')+1
  </code></pre>
  
  <p>I tried above but it sequence all the way. And I need to cut off at 38 for  <strong>E0,F1,I1,SP1</strong> and 34 for <strong>D1</strong>
  I have created a sample dataframe similar to my data uploaded above.</p>
  
  <pre><code>df = pd.DataFrame()
  df['HomeTeam'] = ['A','B','C','D','E','F','G','H','I','J','A','B','C','D','E','F','G','H','I','J','A','B','C','D','E','F','G','H','I','J','A','B','C','D','E','F','G','H','I','J']
  df['Div'] = ['E1','E1','E2','E2','E3','E3','E4','E4','E5','E5','E1','E1','E2','E2','E3','E4','E4','E4','E5','E5','E1','E1','E2','E2','E3','E4','E4','E4','E5','E5','E1','E1','E2','E2','E3','E4','E4','E4','E5','E5']
  </code></pre>
  
  <p>The expected output is as follow:</p>
  
  <pre><code>df['GW'] = ['1','2',
              '1','2',
              '1','2',
              '1','2',
              '1','2',
              '1','2',
              '1','2',
              '1','2',
              '1','2',
              '1','2',
              '1','2',
              '1','2',
              '1','2',
              '1','2',
              '1','2',
              '1','2',
              '1','2',
              '1','2',
              '1','2',
              '1','2']
  </code></pre>
  
  <p>Above simple data frame</p>
  
  <p>Can anyone one advise how to do that?
  Thanks.</p>