I have data frame like this
I need to bin 'a' column into n intervals (5 for example), but intervals must have equal or similar sum of 'b' value
I want result similar to pd.cut on 'a' column
But if we group by sum must be equal or similar (not as on next pic, made with pd.cut)