title: Grouping numerical values in pandas
body: <p>In my <code>Dataframe</code> I have one column with numeric values, let say - distance. I want to find out which group of distance (range) have the biggest number of records (rows).</p>
  
  <p>Doing simple:
  <code>df.distance.count_values()</code> returns:</p>
  
  <pre><code>74         1
  90         1
  94         1
  893        1
  889        1
  885        1
  877        1
  833        1
  122        1
  545        1
  </code></pre>
  
  <p>What I want to achieve is something like buckets from histogram, so I am expecting output like this:</p>
  
  <pre><code>900         4 #all values &lt; 900 and &gt; 850
  100         3
  150         1
  550         1
  850         1
  </code></pre>
  
  <p>The one approach I've figured out so far, but I don't think is the best and most optimal one is just find max and min values, divide by my step (50 in this case) and then do loop checking all the values and assigning to appropriate group.</p>
  
  <p>Is there any other, better approach for that?</p>