title: Vectorizing a function using numpy vectorize
body: <p>I want to vectorize the following function. The arguments are numpy arrays.</p>
  
  <pre><code>def euclidean_distance(dl, dr):
      return math.sqrt(((dl - dr) ** 2).sum())
  </code></pre>
  
  <p>I do the following </p>
  
  <pre><code>v_u = numpy.vectorize(euclidean_distance)
  </code></pre>
  
  <p>and I am doing the following call</p>
  
  <pre><code>v_u(numpy.array([[10, 20, 30], [4, 5, 6]]), numpy.array([1, 2, 3]))
  </code></pre>
  
  <p>What I want is that I get back an array which contains the euclidean distance of <code>[1, 2, 3]</code> with <code>[10, 20, 30], [4, 5, 6]</code>.</p>
  
  <p>I think I am missing something obvious.</p>
  
  <p><strong>EDIT:</strong><br>
  The following is the error I get</p>
  
  <pre><code>AttributeError: 'int' object has no attribute 'sum'
  </code></pre>
  
  <p>which is obvious that <code>dl</code> and <code>dr</code> are passed as single elements but not as arrays... 
  So I was wondering if somebody could correct it so that it operated on arrays.</p>
  
  <p>Thanks a lot</p>