I would like to know how can I select the values with more than one repetition when using numpy random to randomly generate numbers. I am doing the following:
1) First generate the numbers between 1-10
ran = ceil( np.random.random(10)*10 )
print ran
[ 2. 9. 8. 9. 10. 8. 10. 7. 1. 1.]
2) Now using itemfreq from scipy.stats to get the frequency table where the second column is the frequency.
freq_tmp = itemfreq(ran)
print freq_tmp
[[ 1. 2.]
[ 2. 1.]
[ 7. 1.]
[ 8. 2.]
[ 9. 2.]
[ 10. 2.]]
print freq_tmp[0:][:,1]
[ 2. 1. 1. 2. 2. 2.]
this show me only the frequency but I would like to know the values with more than 1 repetition, in this example should be:
[1. 8. 9. 10]
Thank you for your help!
Aucun commentaire:
Enregistrer un commentaire