title: Numpy: Divide each row by a vector element
body: <p>Suppose I have a numpy array:</p>
  
  <pre><code>data = np.array([[1,1,1],[2,2,2],[3,3,3]])
  </code></pre>
  
  <p>and I have a corresponding "vector:"</p>
  
  <pre><code>vector = np.array([1,2,3])
  </code></pre>
  
  <p>How do I operate on <code>data</code> along each row to either subtract or divide so the result is:</p>
  
  <pre><code>sub_result = [[0,0,0], [0,0,0], [0,0,0]]
  div_result = [[1,1,1], [1,1,1], [1,1,1]]
  </code></pre>
  
  <p>Long story short: How do I perform an operation on each row of a 2D array with a 1D array of scalars that correspond to each row?</p>