Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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'])
Source by datascience.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #pandas #resamples #stratified #columns #values
ADD COMMENT
Topic
Name
9+3 =