'How to Return Bin Ranges of multiple rows to a New Column with Calculated Bin Values in the Same DataFrame

I have this calculated dataset

calcDF

properties bincount

a 20

b 6

c 15

d 2

e 9

Then I have this main dataframe with the values

rawDF

a b c d e

10 26 49 18 22

21 11 29 56 14

35 41 23 33 3

51 8 12 20 11

27 10 4 29 5

I'm desperately needing a suggestion on how i can output the ranges as a column in calDF

My expected result is below

properties bincount properties

a 20 (2,5), (5,8),(8,11)

b 6 (1,2), (2,3)

c 15 (50,70), (70,90), (90, 110), (110, 130)

d 2 (5,10), (10, 15)

e 9 (90, 110), (110, 130)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source