populations = [[0 1]
[1 1]
[0 1]
[0 1]]
score = [0, 6, 4, 4]
best_score = max(score)
What I want to do is to get chromosome_best by first, matching
best_score with score and get the index that match in score, then using this index, get its corresponding value in populations
My code so far looks like this:
chromosome_best = numpy.array([d for a, d in zip(score, populations) if a == best_score])
But how could I change it such that when score has non-unique values, example:
score = [6, 6, 0, 4]
best_score = 6
The chromosome_best that would be read is the first match between score and best_score?