title: Pandas: Compare every two rows and output result to a new dataframe
body: <pre><code>import pandas as pd
  df1 = pd.DataFrame({'ID':['i1', 'i2', 'i3'],
                     'A': [2, 3, 1],
                     'B': [1, 1, 2],
                     'C': [2, 1, 0],
                     'D': [3, 1, 2]})
  
  df1.set_index('ID')
  
  df1.head()
  
  
      A   B   C   D  
  ID          
  i1  2   1   2   3   
  i2  3   1   1   1   
  i3  1   2   0   2
  
  
  df2 = pd.DataFrame({'ID':['i1-i2', 'i1-i3', 'i2-i3'],
                     'A': [2, 1, 1],
                     'B': [1, 1, 1],
                     'C': [1, 0, 0],
                     'D': [1, 1, 1]})
  
  df2.set_index('ID')
  df2
  
          A   B   C   D
  ID              
  i1-i2   2   1   1   1
  i1-i3   1   1   0   1
  i2-i3   1   1   0   1
  </code></pre>
  
  <p>Given a data frame as df1, I want to compare every two different rows, and get the smaller value at each column, and output the result to a new data frame like df2. 
  For example, to compare <code>i1</code> row and <code>i2</code> row, get new row <code>i1-i2</code> as <code>2, 1, 1, 1</code>
  Please advise what is the best way of pandas to do that.</p>