text_plain_output_1.png
from sklearn import model_selection

import pandas as pd

df_train = pd.read_csv('../input/30-days-of-ml/train.csv')

df_train['kfold'] = -1

df_train.shape

kf = model_selection.KFold(n_splits=5, shuffle=True, random_state=42)
for fold, (train_indicies, valid_indicies) in enumerate(kf.split(X=df_train)):
    df_train.loc[valid_indicies, 'kfold'] = fold
    print(f'fold = {fold} <train_indicies = {train_indicies}> <valid_indicies = {valid_indicies}>')
    print(len(train_indicies), len(valid_indicies))