How can I left join between two df by multiple conditions and dynamic probabilities?
I would like to left join 3 times between tables A and B and the conditions should be dynamic. It's a bit complex so I'll try to explain with an example:
In table A - Column A should contain one number from table B by this logic- All the numbers in table B that are equal/less than the amount we have in the amount column in table A. So for instance: 120 (table A) should get one of the following in table B - 120,110,100,90,80. The number should be selected by probabilities - I want to be able to define probabilities for those numbers (for example, 120 - 20%, 110 - 5%, 100 - 50%, 90 - 10%, 80 - 15%).
Column B should contain one number from table B by this logic- All the numbers in table B that are greater and not equal to 999 to the amount we have in the amount column in table A. So for instance: 120 (table A) should get one of the following in table B - 130,140,150,160,170. The number should be selected by probabilities - I want to be able to define probabilities for those numbers (for example, 130 - 20%, 140 - 5%, 150 - 50%, 160 - 10%, 170 - 15%).
Column C in table A should always get 999.
Hopefully I managed to explain myself. Thanks in advance.