title: How to filter rows from a csv file based on threshold numerical values using python
body: <p>I have a .csv file with three columns and many rows, where the 1st column is names and the 2nd and 3rd columns are values. I want to filter out any rows that have values less than 1. So I wrote a script to read through the file and write to a new file if the values in <code>row[1] and row[2]</code> are <code>&gt;=1</code>. However, my output file contains everything in my input file, including rows with 0's. I can't figure out what is wrong. Any help is very much appreciated!</p>
  
  <pre><code>from sys import argv
  
  script, filename, outputfile = argv
  
  import csv
  #with open(filename,'r'), open (outputfile,'w') as fin, fout:
  with open(filename,'r') as fin, open (outputfile,'w') as fout:
      writer = csv.writer(fout, delimiter=',')       
      for row in csv.reader(fin, delimiter=','):
          #if row[1] and row[2] &gt;= 1:
          if row[1] &gt;=1 and row[2] &gt;= 1:
               writer.writerow(row)
  </code></pre>