mardi 2 juin 2015

Python Get Random Sample of List of Tuples

I have a list of over million tuples and want a list of 100,000 tuples randomly sampled from that original list without replacement. I have read:

How do I pick 2 random items from a Python set?

but the solution provided (using random.sample while casting list to a set) does not work for tuples.

I am using Python 2.7




Aucun commentaire:

Enregistrer un commentaire