# Divide a dataset while keeping its unbalance

I would like to divide a dataset in three part while keeping its unbalance.

For instance let's assume I have a dataset X unbalanced whith 70% majority labels and 30% minority labels.

I would like to get

Y, Z, T with Y + Z + T = X such as Y and Z and T have 70% majority labels and 30 % minority labels.

If anyone can help, thanks in advance

By sampling randomly from the main dataset the percentages from the subsets should roughly equal the percentages from the main dataset. If you however want a more precise way of doing this look into using a stratified method, which allows you to keep class frequencies when splitting/sampling the data. The scikit-learn implementation of the train_test_split function provides the stratify keyword to automatically split a dataset using stratification.
I wrote a code that mimics stratify of train_test_split. See here