say I have a list:
a = [3, 5, 1, 1, 3, 2, 4, 1, 6, 4, 8]
and optional list a:
b = [5, 2, 6, 8]
I would like to get cells using pd.qcut(a,2) and count the number of values ββin each box for list b. it
In[84]: pd.qcut(a,2) Out[84]: Categorical: [[1, 3], (3, 8], [1, 3], [1, 3], [1, 3], [1, 3], (3, 8], [1, 3], (3, 8], (3, 8], (3, 8]] Levels (2): Index(['[1, 3]', '(3, 8]'], dtype=object)
Now I know that the boxes are [1,3] and (3,8), and I would like to know how many values ββare in each box for list "b". I can do this manually when the number of pins is small, but what is the best approach when the number of bins is large?