I am trying to figure an elegant way of implementing the distribution of an amount into a given set of slots in python.
For example:
7 oranges distributed onto 4
Not sure how this works. But it returns the exact same results
a = 23 b = 17 s = pd.Series(pd.cut(mylist, b), index=mylist) s.groupby(s).size().values