title: Pandas qcut with groupby with non-unique values
body: <p>I'm trying to do a groupby on a pandas dataframe and on that groupby do a qcut, to classify the values on a quantile. The problem is that some groups have only one value, so qcut complains with <code>ValueError: Bin edges must be unique</code>. Is there a way to simply ignore these cases on the groupby and qcut?</p>
  
  <p>I'm doing something like</p>
  
  <pre><code>df['quantile'] = df.groupby(['grouping'])['values'].transform(
                   lambda x: pd.qcut(x, 4))
  </code></pre>
  
  <p>I can do this way on a two level grouping</p>
  
  <pre><code>pd.qcut(df.groupby(['grouping', 'param1']).sum()['value'],[0.15,0.25,0.5,0.75,1.0], labels=['0.15', '0.25', '0.5', '0.75'])
  </code></pre>
  
  <p>But I'm not sure that the results are the quantiles inside each group for the parameter <code>grouping</code> or for the entire dataframe.</p>