title: Ambiguous Evaluation of Lambda Expression on Array
body: <p>I would like to use a <code>lambda</code> that adds one to x if x is equal to zero. I have tried the following expressions:</p>
  
  <pre><code>t = map(lambda x: x+1 if x==0 else x, numpy.array())
  t = map(lambda x: x==0 and x+1 or x, numpy.array())
  t = numpy.apply_along_axis(lambda x: x+1 if x==0 else x, 0, numpy.array())
  </code></pre>
  
  <p>Each of these expressions returns the following error:</p>
  
  <pre><code>ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
  </code></pre>
  
  <p>My understanding of <code>map()</code> and <code>numpy.apply_along_axis()</code> was that it would take some function and apply it to each value of an array. From the error it seems that the the lambda is being evaluated as <code>x=array</code>, not some value in array. What am I doing wrong?</p>
  
  <p>I know that I could write a function to accomplish this but I want to become more familiar with the functional programming aspects of python.</p>