lundi 17 septembre 2018

sum from array until a given value is reached.

I have several numpy arrays with values, that look as follows:

po_freq1 = [0.01408451 0.05633803 0.14084507 0.02816901 0.01408451 0.01408451
0.05633803 0.05633803 0.01408451 0.01408451 0.01408451 0.01408451
0.02816901 0.07042254 0.01408451 0.01408451 0.04225352 0.11267606
0.04225352 0.01408451 0.04225352 0.02816901 0.01408451 0.04225352
0.05633803 0.01408451 0.01408451 0.01408451]

my goal is to chose randomly some values from my array and sum these values until a given value for example 0.90 is reached. Does anyone have an idea?




Aucun commentaire:

Enregistrer un commentaire