title: How to normalize a 2-dimensional numpy array in python less verbose?
body: <p>Given a 3 times 3 numpy array</p>
  
  <pre><code>a = numpy.arange(0,27,3).reshape(3,3)
  
  # array([[ 0,  3,  6],
  #        [ 9, 12, 15],
  #        [18, 21, 24]])
  </code></pre>
  
  <p>To normalize the rows of the 2-dimensional array I thought of</p>
  
  <pre><code>row_sums = a.sum(axis=1) # array([ 9, 36, 63])
  new_matrix = numpy.zeros((3,3))
  for i, (row, row_sum) in enumerate(zip(a, row_sums)):
      new_matrix[i,:] = row / row_sum
  </code></pre>
  
  <p>There must be a better way, isn't there?</p>
  
  <p>Perhaps to clearify: By normalizing I mean, the sum of the entrys per row must be one. But I think that will be clear to most people.</p>