title: Scipy: Calculation of standardized euclidean via cdist
body: <p>The formula is available in the docs and pointed to in this <a href="https://stackoverflow.com/a/31735609/3656081">answer</a>. However when I'm trying to apply it I'm not getting a matching answer. I'm sure there's some silly mistake I'm making somewhere so thanks for bearing with me:</p>
  
  <hr>
  
  <p><strong>Setup</strong></p>
  
  <p>Say I have 2 matrices:</p>
  
  <pre><code>X: array([[0, 1, 0],
         [1, 1, 1]])
  X2: array([[1, 1, 0],
         [1, 1, 1],
         [1, 2, 0]])
  </code></pre>
  
  <p>Now applying <code>Xans = scipy.spatial.distance.cdist(X, X2, 'seuclidean')</code> gives:</p>
  
  <pre><code>Xans: array([[2.23606798, 2.88675135, 3.16227766],
         [1.82574186, 0.        , 2.88675135]])
  </code></pre>
  
  <p>Let's just focus on <code>Xans[0][0] = 2.23606798</code>, which should have been obtained by applying <code>seuclidean(X[0], X2[0])</code>.</p>
  
  <hr>
  
  <p><strong>Method 1: Using pdist</strong></p>
  
  <p>I tried doing this via <code>pdist</code> but get a NaN:</p>
  
  <pre><code>In [104]: scipy.spatial.distance.pdist([X[0], X2[0]], metric='seuclidean')
  Out[104]: array([nan])
  </code></pre>
  
  <p>Why is this happening?</p>
  
  <hr>
  
  <p><strong>Method 2: Direct Formula Application</strong></p>
  
  <p>I tried manually using the formula linked in the answer above as follows:</p>
  
  <pre><code>In [107]: (((X[0] - X2[0])**2).sum()/(np.var([X[0], X2[0]])))**0.5
  Out[107]: 2.0
  </code></pre>
  
  <p>As can be seen this is giving 2.0?</p>
  
  <p>I'm clearly doing something very wrong - What is it?</p>