title: Pairwise Euclidean distance with pandas ignoring NaNs
body: <p>I start with a dictionary, which is the way my data was already formatted:</p>
  
  <pre><code>import pandas as pd
  dict2 = {'A': {'a':1.0, 'b':2.0, 'd':4.0}, 'B':{'a':2.0, 'c':2.0, 'd':5.0}, 
  'C':{'b':1.0,'c':2.0, 'd':4.0}}
  </code></pre>
  
  <p>I then convert it to a pandas dataframe:</p>
  
  <pre><code>df = pd.DataFrame(dict2)
  print(df)
       A    B    C
  a  1.0  2.0  NaN
  b  2.0  NaN  1.0
  c  NaN  2.0  2.0
  d  4.0  5.0  4.0
  </code></pre>
  
  <p>Of course, I can get the difference one at a time by doing this:</p>
  
  <pre><code>df['A'] - df['B']
  Out[643]: 
  a   -1.0
  b    NaN
  c    NaN
  d   -1.0
  dtype: float64
  </code></pre>
  
  <p>I figured out how to loop through and calculate A-A, A-B, A-C:</p>
  
  <pre><code>for column in df:
  print(df['A'] - df[column])
  
  a    0.0
  b    0.0
  c    NaN
  d    0.0
  Name: A, dtype: float64
  a   -1.0
  b    NaN
  c    NaN
  d   -1.0
  dtype: float64
  a    NaN
  b    1.0
  c    NaN
  d    0.0
  dtype: float64
  </code></pre>
  
  <p>What I would like to do is iterate through the columns so as to calculate |A-B|, |A-C|,  and |B-C| and store the results in another dictionary.</p>
  
  <p>I want to do this so as to calculate the Euclidean distance between all combinations of columns later on. If there is an easier way to do this I would like to see it as well. Thank you.</p>