title: How to automatically decide the max number of quantiles when using qcut given a number in pandas?
body: <p>Goal: I want to find cut values with max equal bins using <code>qcut</code> given a <code>q</code> value. But I have to try one by one to find it. Here is the details:</p>
  
  <pre><code>max_bin = 12
  
  pd.qcut([0,1,1,2,3,3,4,4,5,6,7],q=max_bin) 
  </code></pre>
  
  <p>It would raised <code>ValueError: Bin edges must be unique</code>.Then I try <code>11</code> it works.</p>
  
  <p>Hope: Set a function that can automatically find max bins given a <code>q</code> values.</p>