import numpy as np
import pandas as pd

import os
for dirname, _, filenames in os.walk('/kaggle/input'):
    for filename in filenames:
        print(os.path.join(dirname, filename))
"""
# Reading Train Data
"""
df_train = pd.read_csv("../input/tabular-playground-series-sep-2021/train.csv")
df_train.head()
"""
Here, the colum "claim" is the target value. From, the histogram below, we can see value of "claim" is either 0 or 1.
"""
df_train.claim.hist()
"""
**For splliting the data used for k-fold cross validation, a new column 'kfold' is created**
"""
df_train["kfold"] = -1
from sklearn import model_selection

kf = model_selection.KFold(n_splits=10,shuffle= True, random_state=42)

for fold, (train_indices,valid_indices) in enumerate(kf.split(X=df_train)):
    df_train.loc[valid_indices,"kfold"] = fold
df_train.head()
df_train.kfold.value_counts()
df_train.to_csv("train_10_folds.csv",index=False)
df_train[df_train.kfold==1].claim.hist()
df_train[df_train.kfold==2].claim.hist()