title: How do I average values of a group range in pandas?
body: <p>I have this Dataframe. I want to make age range 1-5, 6-10, 11-15, etc and set all values in this range by their mean.</p>
  <pre><code>    Name  Age  
  0    x    5
  1    y    7
  2    z    2
  3    p    9
  4    q    12
  5    r    6
  6    s    5
  7    t    1
  8    u    13
  9    v    10
  </code></pre>
  <p>Now I want to add a column <strong>ageGroup</strong> which will contain the <strong>mean</strong> of the required range. Here 1-5 is a range. so all of the ages between these will <strong>mean</strong> value. Here, (5+2+5+1) // 4 = 3. Similarly, for range 11-15 will be (12+13) // 2 = 12.</p>
  <p>So, the expected output is.</p>
  <pre><code>    Name  Age  ageGroup
  0    x    5     3
  1    y    7     8
  2    z    2     3
  3    p    9     8
  4    q    12    12
  5    r    6     8
  6    s    5     3
  7    t    1     3
  8    u    13    12
  9    v    10    8
  </code></pre>