title: Python: select random values for a column from csv
body: <p>I have a problem to print random values from a csv for a given column name/index (my second day in Python world :) )</p>
  
  <p>I have so far managed to write the following -</p>
  
  <pre><code>#!/usr/bin/python
  
  import csv   # This will help us reading csv formated files.
  
  import random # This will random method
  
  load_file= open('&lt;filename&gt;',"rb")
  
  reader= csv.reader(load_file) #The reader method will put each line
                               # of the csv file into a list of columns
  
  for row in reader:
  
          from random import shuffle
          shuffle(row[2])
  
          print row[2]
  
  
  load_file.close();
  </code></pre>
  
  <p>It is printing a shuffled (random) values from the third column in the file.</p>
  
  <p>objectives -
  . define the number of values 1000,2000,50000 etc.
  . The values are highly skewed how to ensure uniform distribution ? e.g. if the column has got mostly 0s &amp; few 1s I want to see both values in the output for any sample size.
  . write this into a file. (not urgent at this point)</p>
  
  <p>I am using python 2.6.6</p>