mardi 1 septembre 2020

How can I sample data whilst specifying the number of unique values in the sample

I have data of 100,000 rows, containing an attribute X with 300 unique values. I want to generate a sample of a given size of the data containing 15% of the 300 unique values in X.

How can I do this using python (numpy/pandas)?




Aucun commentaire:

Enregistrer un commentaire