title: Pandas - Euclidean Distance Between Columns
body: <p>I have a dataframe as follows:</p>
  <pre class="lang-py prettyprint-override"><code>           uuid        x_1         y_1         x_2         y_2
  0        di-ab5      82.31      184.20      148.06      142.54  
  1        di-de6      92.35      185.21       24.12       16.45
  2        di-gh7     123.45        0.01         NaN         NaN 
  ...
  </code></pre>
  <p>I am trying to calculate the euclidean distance between <code>[x_1, y_1]</code> and <code>[x_2, y_2]</code> in a new column (not real values in this example).</p>
  <pre class="lang-py prettyprint-override"><code>           uuid       dist
  0        di-ab5      12.31    
  1        di-de6      62.35   
  2        di-gh7        NaN
  </code></pre>
  <p>Caveats:</p>
  <ol>
  <li>some rows have <code>NaN</code> on some of the datapoints</li>
  <li>it is okay to represent data in the original dataframe as points (i.e. <code>[1.23, 4.56]</code>) instead of splitting up the x and y coordinates</li>
  </ol>
  <p>I am currently using the following script:</p>
  <pre class="lang-py prettyprint-override"><code>df['dist']  = np.sqrt((df['x_1'] - df['x_2'])**2 + (df['y_1'] - df['y_2'])**2)
  </code></pre>
  <p>But it seems verbose and often fails.
  Is there a better way to do this using pandas, numpy, or scipy?</p>