title: python dataframe matrix of Euclidean distance
body: <p>I would like to create an own customized k nearest neighbor method. </p>
  
  <p>For this I would need a matrix (x : y) which returns the distance for each combination of x and y for a given function (e.g. euclidean based on 7 items of my dataset). </p>
  
  <p>e.g. </p>
  
  <pre><code>data:
     x1  x2  x3
    row 1:  1   2   3
    row 2:  1   1   1 
    row 3:  4   2   3
  </code></pre>
  
  <p>if I select x1 and x2 and euclidean, then the output should be a 3x3 output</p>
  
  <pre><code>1:1=0
  1:2 =sqrt((1-1)^2+(2-1)^2)=1
  1:3 =sqrt((1-4)^2+(2-2)^2)=sqrt(3)
  2:1=1:2=1
  2:2=0
  2:3=sqrt((1-4)^2+(1-2)^2)=2
  3:3=0
  </code></pre>
  
  <p>and so forth...</p>
  
  <p>how to write that without iterating through the dataframe?</p>
  
  <p>Thanks in advance for your support.</p>