I have a list of lists, like so:
a = [[1,2],[2,3]]
I want to create a random list with replacement of a given size from a. The numpy.random.choice() method only accepts 1D arrays. I can write my own function to do this, but is there already an optimized way?
Expected output:
[[1,2],[1,2],[2,3],[2,3]] //the size (4 here) has to be a parameter passed to the function
Aucun commentaire:
Enregistrer un commentaire