Is there a function in Python Pandas which randomly selects a row based on the values from a column in a dataframe (Function to perform roulette wheel selection)?
i.e.
id value
1 1
2 2
3 3
Then with chance 1/(1+2+3) row 1 is selected, chance 2/6 row 2 and 3/6 row 3.
I know it is easy to write your own function with a random number between 0 and sum(value) and for loop and then select the row but I was wondering if there was a pre-defined function.