mercredi 29 septembre 2021

randomly sampling of dataset to decrease the values in the dataset

I am currently trying to decrease the values in a column randomly according to a given sum. For example, if the main data is like this;

ID Value

1 4
2 10
3 16

after running the code the sum of Value should be 10 and this need to be done randomly(the decrease for each member should be chosen randomly)

ID Value

1 1
2 8
3 1

Tried several command and library but could not manage it. Still a novice and Any help would be appreciated!

Thanks




Aucun commentaire:

Enregistrer un commentaire