title: Changing a numpy array in place based on values in a given column?
body: <p>I have a numpy array:</p>
  
  <pre><code>array([[ 0.68597575,  0.05544651, -1.        ],
         [ 0.33494648,  0.46368367,  1.        ],
         [ 0.42486765,  0.89427025,  1.        ],
         [ 0.62408611,  0.64633939,  1.        ],
         [ 0.37087957,  0.53077302, -1.        ],
         [ 0.21664159,  0.10786084, -1.        ],
         [ 0.13003626,  0.18425347, -1.        ]])
  </code></pre>
  
  <p>I want the rows having last values <code>-1</code> to be multiplied by -1 and also replaced in the actual matrix.</p>
  
  <p>I tried this:</p>
  
  <pre><code>def transform(data):
      for row in data:
          if row[-1] == -1:
              row = row * -1
  </code></pre>
  
  <p>but I know there would be something simpler than this.</p>