I had obtained the index of training set and testing set with code below.
df = pandas.read_pickle(filepath + filename)
kf = KFold(n_splits = n_splits, shuffle = shuffle, random_state =
randomState)
result = next(kf.split(df), None)
#train can be accessed with result[0]
#test can be accessed with result[1]
I wonder if there is any faster way to separate them into 2 dataframe respectively with the row indexes I retrieved.