title: Better binning in pandas
body: <p>I've got a data frame and want to filter or bin by a range of values and then get the counts of values in each bin. </p>
  
  <p>Currently, I'm doing this:</p>
  
  <pre><code>x = 5
  y = 17
  z = 33
  filter_values = [x, y, z]
  filtered_a = df[df.filtercol &lt;= x]
  a_count = filtered_a.filtercol.count()
  
  filtered_b = df[df.filtercol &gt; x]
  filtered_b = filtered_b[filtered_b &lt;= y]
  b_count = filtered_b.filtercol.count()
  
  filtered_c = df[df.filtercol &gt; y]
  c_count = filtered_c.filtercol.count()
  </code></pre>
  
  <p>But is there a more concise way to accomplish the same thing?</p>