title: How to add a number to elements of a numpy array but not all elements?
body: <p>This is what I'm trying to do:
  I have a 2D numpy array:</p>
  <pre><code>A = [[   0,    0,  400,  400],
       [   0,  400,  400,  800],
       [   0,  800,  400, 1010],
       [ 400,    0,  800,  400],
       [ 400,  400,  800,  800],
       [ 400,  800,  800, 1010],
       [ 800,    0,  910,  400],
       [ 800,  400,  910,  800],
       [ 800,  800,  910, 1010]]
  </code></pre>
  <p>I want to add +20 to all the non-zeros elements of the 1st column. So, the answer should look like this:</p>
  <pre><code>A =[[   0,    0,  400,  400],
      [   0,  420,  400,  800],
      [   0,  820,  400, 1010],
      [ 400,    0,  800,  400],
      [ 400,  420,  800,  800],
      [ 400,  820,  800, 1010],
      [ 800,    0,  910,  400],
      [ 800,  420,  910,  800],
      [ 800,  820,  910, 1010]]
  </code></pre>
  <p>It is possible with loops, but isn't there a vectorized method, or something within the numpy library to implement this?</p>
  <p>All I can think of is:</p>
  <pre><code>A[:,1] = A[:,1][A[:,1] != 0] + 20
  </code></pre>
  <p>but it doesn't work the way I want it to because it only returns a decremented array with only the modified non-zero values, hence it gives an error.</p>