title: Creating Kfold cross validation set without sklearn
body: <p>I am trying to split my data into K-folds with train and test set. I am stuck at the end:</p>
  
  <p>I have a data set example:</p>
  
  <pre><code>       [1,2,3,4,5,6,7,8,9,10]
  </code></pre>
  
  <p>I have successful created the partition for 5-fold cross validation and the output is </p>
  
  <pre><code>     fold=[[2, 1], [6, 0], [7, 8], [9, 5], [4, 3]]
  </code></pre>
  
  <p>Now I want to create K such instances having K-1 training data and 1 validation set.</p>
  
  <p>I am using this code:</p>
  
  <pre><code>    ```
        cross_val={"train":[],"test":[]}
         new_fold=folds.copy()
         for i in range(4):
             val=folds.pop(i)
             cross_val["train"].append(folds)
             cross_val["test"].append(val)
  
             folds[i:i]=[val]```
  </code></pre>
  
  <p>The output that I am getting is:</p>
  
  <pre><code>  {'train': [[[6, 0], [7, 8], [9, 5], [4, 3]],
             [[6, 0], [7, 8], [9, 5], [4, 3]],
            [[6, 0], [7, 8], [9, 5], [4, 3]],
          [[6, 0], [7, 8], [9, 5], [4, 3]]],
     'test': [[6, 0], [7, 8], [9, 5], [4, 3]]}
  </code></pre>
  
  <p>This is the wrong output that I am getting.</p>
  
  <p>But I want the output as</p>
  
  <pre><code>          train                                   test
            [[6, 0], [7, 8], [9, 5], [4, 3]]      [2,1]
            [[2, 1], [7, 8], [9, 5], [4, 3]]      [6,0]
            [[6, 0], [2, 1], [9, 5], [4, 3]]      [7,8]
            [[6, 0], [7, 8], [9, 5], [2, 1]]       [4,3]
            [[6, 0], [7, 8], [2, 1], [4, 3]]       [9,5]
  </code></pre>