title: Counting number of items based on condition
body: <p>I have the following dataset.</p>
  
  <ol>
  <li>1 2</li>
  <li>2 5</li>
  <li>3 4</li>
  <li>4 7</li>
  <li>6 8</li>
  <li>7 6</li>
  </ol>
  
  <p>My aim is to have a count of numbers in column 2 which are less than or equal 6. The numbers in column 2 which are less than or equal to 6 are 2,4,5 and 6. So, i want the output to be 4 as 2,4,5 and 6 are all appearing once, so total appearance count=4.</p>
  
  <p>My approach has been:</p>
  
  <pre><code>import numpy as np
  data=np.loadtxt('/Users/Hrihaan/Desktop/A.txt')
  x=data[:,1]
  Count=list(x.flatten()).count(6)  #it only counts the number of times 6 appears in the list.
  </code></pre>
  
  <p>Any suggestion on how to manipulate the code to get a count for numbers equal or less than 6 would mean a lot.</p>