title: Simple operations on every element in numpy arrays
body: <p>I'm a newbie at numpy, but I was of that notion that you should not iterate over numpy arrays as this defies the purpose of numpy.</p>
  
  <p>I'm trying to perform elementwise operations on a numpy array, but I don't understand the syntax apparantly:</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>for line in fidNNC:
      temp = line.strip().split()
      temp.insert(0,0)
      CC.append(temp[0:7])
  
  fidNNC.close()
  NNC = np.array(CC)
  del(CC)
  
  inds = np.arange(len(NNC))[ NNC[:,4]-1 == NNC[:,1] ]
  NNCX = NNC[inds,:]
  inds = np.arange(len(NNC))[ NNC[:,5]-1 == NNC[:,2] ]
  NNCY = NNC[inds,:]
  </code></pre>
  
  <p>The file <code>fidNNC</code> contains about a million rows and ten columns of ints.</p>
  
  <p><strong>Error message:</strong> </p>
  
  <pre><code>    inds = np.arange(len(NNC))[ NNC[:,4]-1 == NNC[:,1] ]
  TypeError: unsupported operand type(s) for -: 'numpy.ndarray' and 'int'
  </code></pre>
  
  <p>How do I subtract 1 from each and every one element of <code>NNC[:,4]</code> and <code>NNC[:,5]</code> without iterating?</p>
  
  <p>Thanks in advance,</p>
  
  <p>Daniel</p>