title: Calculating pairwise Euclidean distance of 3d points between all the rows of a dataframe
body: <p>I have a dataframe of 200000 rows. The dataframe looks like:</p>
  <pre><code>df = pd.DataFrame([['A-0001',21.8,3.2,6.6,'B-0001',2,8,9],['A-0002',21,3,6,'B-0002',1,8,8],['A-0003',8,9,2,'B-0003',7.64,5.5,12.4]])
  df.columns = ['pointA',&quot;A_x&quot;,&quot;A_y&quot;,&quot;A_z&quot;,'pointB',&quot;B_x&quot;,&quot;B_y&quot;,&quot;B_z&quot;] 
  </code></pre>
  <p>That is :</p>
  <pre><code>pointA   A_x     A_y  A_z    pointB   B_x    B_y    B_z 
  
  A-0001   21.8   3.2   6.6    B-0001    2     8      9
  A-0002    21     3     6     B-0002    1     8      8
  A-0003    8      9     2     B-0002  7.64   5.5    12.4
  </code></pre>
  <p>&quot;A_x&quot;,&quot;A_y&quot;,&quot;A_z&quot; is the coordinate of point A, and &quot;B_x&quot;,&quot;B_y&quot;,&quot;B_z&quot; is the coordinate of pointB</p>
  <p>I want to add a new columns&quot;distance&quot; of df,  df[&quot;distance] is the distance between pointA and point B of each row.</p>
  <p>What is the fastest way?</p>