title: How to get selected row with columns of dataframe using Python?
body: <p>My main idea is separating data in dataframe with multiple columns and rows into training dataset and test dataset.</p>
  
  <p><strong>Edited: I want to use same train and test data everytime. I am trying to avoid random choices.</strong></p>
  
  <p>I have tried this:</p>
  
  <pre><code>def splitTestandTrainData(datavalues):
  
      #create new dataframe with columns
      testDataFrame = pd.DataFrame(columns=datavalues.columns)
  
      #select every 4th row as a test data
      for i in range(1,len(datavalues.rows),4):
  
          #getting single row with all columns
          testDataFrame.append(datavalues.iloc(i))
  
          #and delete
          dataValues.drop(dataValues.index[i])
  </code></pre>
  
  <p>but I cant append row into new dataframe. Im also not sure If it is correct way. How can I do that? </p>
  
  <p>And my other question is What if we want to do it with selected columns? I mean how we can append column with rows into empty dataframe?</p>
  
  <p>Thanks in advance</p>