title: Python, How to print a Pandas Series grouped in range of index values
body: <p>I am new to Pandas and ML. I am reading the book <strong>Think Stats</strong> and going through the exercises. The accompanied code loads the NSFG Cycle 6 data as a dataframe for coding examples.
  One of the exercise instructs the user to use the available function in dataframe to display the Series called 'preglngth'. Then it asks to crosscheck the result with the Codebook from NSFG. My code is as follows,</p>
  
  <pre><code>import nsfg
  df = nsfg.ReadFemPreg()
  df.prglngth.value_counts(sort=True)
  </code></pre>
  
  <p>And I get the following output,  </p>
  
  <pre>
  +----------------+  
  | 39        4744 |  
  | 40        1120 |  
  | 38         609 |  
  | 9          594 |  
  | 41         591 |  
  | 6          543 |  
  | 37         457 |  
  | 13         446 |  
  | 4          412 |  
  | 8          409 |  
  | 35         357 |  
  | 36         329 |  
  +----------------+
  </pre>
  
  <p>and so on...  </p>
  
  <p>Name: prglngth, dtype: int64</p>
  
  <p>The codebook <a href="http://www.icpsr.umich.edu/nsfg6/Controller?displayPage=labelDetails&amp;fileCode=PREG&amp;section=A&amp;subSec=8016&amp;srtLabel=611931" rel="nofollow noreferrer">link</a> displays it in the following way,</p>
  
  <p><a href="https://i.stack.imgur.com/V9iuv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/V9iuv.jpg" alt="Screenclip"></a></p>
  
  <p>I would like to display the Series values based on the range of index values as displayed above. What should I do?
  Thanks.</p>
  
  <p>Krish.</p>