title: How to take random sample from a csv file
body: <p>I have a csv file with 10 rows:</p>
  
  <pre><code>Text,Class
  text0,class0
  text1,class1
  ...
  text9,class9
  </code></pre>
  
  <p>I am classifying the text, and then comparing it to the correct class labeled in the csv file. I want to take a random sample of 4 pieces of text and their class from it. I have:</p>
  
  <pre><code>import random
  textt=data['Text']
  class_one=data['Class']
  c=textt[0:]
  random_sample=random.sample(c,4)
  </code></pre>
  
  <p>My classification then starts with:</p>
  
  <pre><code>for i in random_sample:
  </code></pre>
  
  <p>but when i calculate the accuracy of the classification, it calculates it for the entire dataset. How can I get it to only calculate the accuracy for just the sample of 4 pieces of data?</p>
  
  <p>edit: 
  for classification, i do:
      for i in textt:
          #classify text
  results will look like:</p>
  
  <pre><code>choice 1
  choice 2
  choice 1
  ...
  </code></pre>
  
  <p>and this is compared to the correct class from the csv file:</p>
  
  <pre><code>choice 1
  choice 2
  choice 2
  ...
  </code></pre>
  
  <p>and accuracy will be calculated as 66.6% with:</p>
  
  <pre><code>for i in class_one:
      #if predicted_class= correct_class: 
      #accuracy=number_correct/total_number
  </code></pre>
  
  <p>I want to only do the classification on the random sample, so instead of classifying all 10 examples, it would only classify 4</p>