title: Apply a lambda function to a 2D array and receive back a 1D array
body: <p>I am trying to apply a simple lambda function to rows on a 2D array, but I cannot quite get it to work.</p>
  <p>Problem as a MWE:</p>
  <pre><code># Data
  D = np.hstack((np.ones(5).reshape(-1,1),2*np.ones(5).reshape(-1,1)))
  
  array([[1., 2.],
         [1., 2.],
         [1., 2.],
         [1., 2.],
         [1., 2.]])
  
  # Function
  f = lambda x: x[0] + x[1]
  </code></pre>
  <p>For reasons I can only specify one lambda argument (i.e. the row of the 2D array in this case), and cannot split the array up into the respective columns i.e. writing <code>lambda x1,x2: ...</code>. Which it to say that I have to index the columns of the input argument rather than pass these as individual arguments.</p>
  <p>Now when I do the following:</p>
  <pre><code>f(D)
  </code></pre>
  <p>I hope to receive back:</p>
  <pre><code>array([[3],
         [3],
         [3],
         [3],
         [3]])
  </code></pre>
  <p>Sadly this is not what is happening. Instead I get:</p>
  <pre><code>array([2., 4.])
  </code></pre>
  <p>I.e. the function is being applied to each column individually, and even then, not to the whole input array either it would seem, just one row.</p>
  <p>Help would be most appreciated.</p>
  <p>Thank you</p>