title: Pandas - cut records with the custom percentiles
body: <p>I have a pandas dataframe with a column of continous variables. I need to convert them into 3 bins, such that first bin encompases values &lt;20 percentile, second between 20 and 80th percentile and last is >80th percentile.</p>
  
  <p>I am trying to achieve it by first getting the bin boundaries for such percentiles and then using pandas cut function. The issue is that I get an odd results, of getting only the middle bin encoded. Please see below:</p>
  
  <pre><code>test = [x for x in range(0,100)]
  a = pd.DataFrame(test)
  
  np.percentile(a, [20, 80])
  Out[52]: array([ 19.8,  79.2])
  
  pd.cut(a[0], np.percentile(a[0], [20, 80]))
  
  ...
  15             NaN
  16             NaN
  17             NaN
  18             NaN
  19             NaN
  20    (19.8, 79.2]
  21    (19.8, 79.2]
  22    (19.8, 79.2]
  ...
  78    (19.8, 79.2]
  79    (19.8, 79.2]
  80             NaN
  </code></pre>
  
  <p>Why is that so? I though pandas cut requires you to supply boundaries of bins you want to get. Supplying 2 boundaries I supposed to get 3 bins, but seems like it doesn't work this way.</p>