Answers for "pandas resamples stratified by columns values"

0

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'])
Posted by: Guest on December-08-2020

Code answers related to "pandas resamples stratified by columns values"

Python Answers by Framework

Browse Popular Code Answers by Language