I'm trying to split a series into buckets of almost the same size keeping the order and without having same items in different buckets.
I'm using qcut like this:
>>> import pandas as pd
>>> pd.__version__
'0.20.3'
>>> x = [1,1,1,1,1,2,2,2,2,3,4]
>>> pd.qcut(x, 10, duplicates='drop').value_counts()
(0.999, 2.0] 9
(2.0, 3.0] 1
(3.0, 4.0] 1
dtype: int64
I was expecting this to split the first bucket into (0.999, 1.0]
, (1.0, 2.0]
.
Why not? Any other approach I should try?