pandas resamples stratified by columns values code example
Example: pandas resamples stratified by columns values
# stratified split dataset by column
from sklearn.model_selection import train_test_split
df_sample, df_drop_it = train_test_split(df, train_size =0.2, stratify=df['country'])