I am testing a very basic line of code.
modDF['RatingDecile'] = pd.cut(modDF['RatingScore'], 10)
This gives me ranges of rating scores in 10 buckets. Instead of the range, how can I see 1, 2, 3, etc., up to 10?
So, instead of this.
      Score RatingQuantile  
0     (26.3, 29.0]  
6     (23.6, 26.3]  
7     (23.6, 26.3]  
8     (26.3, 29.0]  
10    (18.2, 20.9]  
       ...       ...  
9763  (23.6, 26.3]  
9769  (20.9, 23.6]  
9829  (20.9, 23.6]  
9889  (23.6, 26.3]  
9949  (20.9, 23.6] 
How can I get something like this?
      Score RatingQuantile  
0     10  
6     8 
7     8 
8     10  
10    6  
       ...      ...  
9763  8  
9769  5  
9829  5 
9889  5  
9949  5 
I tried this.
modDF['DecileRank'] = pd.qcut(modDF['RatingScore'],10,labels=False)
I got this error.
ValueError: Bin edges must be unique: array([ 2., 20., 25., 27., 27., 27., 27., 27., 27., 27., 29.]).
You can drop duplicate edges by setting the 'duplicates' kwarg
The error makes sense to me. I just don't know the work-around for this issue. Thoughts?