Hellow. I have some trouble with this question:
- i have a list, for example a=[1,4,5,7,10]`
- i need another list with randomly chosen elements from a (b = np.random.choice(a,3,replace=False)`)
But the length of the b must be the same as len(a)
. I guess i confuse someone with that text, so here are example :
- a = [1,4,5,7,10]
- b = [0,4,0,7,10]
so, the elements that wasn't chosen must be zeros. How can i do something like that?
Aucun commentaire:
Enregistrer un commentaire