mardi 14 avril 2020

How to separate a dataset into multiple (more than 2) random samples

If I have a dataset with say 1000 rows, what is the best way to separate the dataset into say 5 random samples (ie. each sample will have 200 rows).

I know there are functions like model_selection.train_test_split() and utils.resample() but these functions only separate the dataset into 2 samples.

Do I first need to generate a list of random numbers, in this case a list of 1000 random numbers (say from 1 to 1000), and then take the index in the dataset corresponding to having numbers 1 to 200 as the first random sample, 201 to 400 as the second random sample, 401 to 600 as the third random sample etc.

Or is there a function in Python somewhere that I could use (to make my life easier)?




Aucun commentaire:

Enregistrer un commentaire