Hello there everyone,
I am currently working on a program to generate random numbers based on percentages using python. Unfortunately, I am not very familiar with python.
I created a dataframe with a size of 30 (30 rows), it has a column 'rand_number'. I want to generate a different random number in this column but based on percentages.
'rand_number' is supposed to generate random numbers between 0-7 and with probabilities of:
- 0 = %1.5
- 1 = %17
- 2 = %35
- 3 = %20
- 4 = %13
- 5 = %5.5
- 6 = %3
- 7 = %2.5
- (there may appear numbers between 8-20 but it has very low probability) = %0.5
How can I do this? Your help would be appreciated.
Aucun commentaire:
Enregistrer un commentaire