title: Subtract first row from all rows in Pandas DataFrame
body: <p>I have a pandas dataframe:</p>
  
  <pre><code>a = pd.DataFrame(rand(5,6)*10, index=pd.DatetimeIndex(start='2005', periods=5, freq='A'))
  a.columns = pd.MultiIndex.from_product([('A','B'),('a','b','c')])
  </code></pre>
  
  <p>I want to subtract the row <code>a['2005']</code> from <code>a</code>. To do that I've tried this:</p>
  
  <pre><code>In [22]:
  
  a - a.ix['2005']
  
  Out[22]:
      A   B
      a   b   c   a   b   c
  2005-12-31  0   0   0   0   0   0
  2006-12-31  NaN     NaN     NaN     NaN     NaN     NaN
  2007-12-31  NaN     NaN     NaN     NaN     NaN     NaN
  2008-12-31  NaN     NaN     NaN     NaN     NaN     NaN
  2009-12-31  NaN     NaN     NaN     NaN     NaN     NaN
  </code></pre>
  
  <p>Which obviously doesn't work because pandas is lining up the index while doing the operation. This works:</p>
  
  <pre><code>In [24]:
  
  pd.DataFrame(a.values - a['2005'].values, index=a.index, columns=a.columns)
  
  Out[24]:
      A   B
      a   b   c   a   b   c
  2005-12-31  0.000000    0.000000    0.000000    0.000000    0.000000    0.000000
  2006-12-31  -3.326761   -7.164628   8.188518    -0.863177   0.519587    -3.281982
  2007-12-31  3.529531    -4.719756   8.444488    1.355366    7.468361    -4.023797
  2008-12-31  3.139185    -8.420257   1.465101    -2.942519   1.219060    -5.146019
  2009-12-31  -3.459710   0.519435    -1.049617   -2.779370   4.792227    -1.922461
  </code></pre>
  
  <p>But I don't want to have to form a new DataFrame every time I have to do this kind of operation. I've tried the apply() method like this: <code>a.apply(lambda x: x-a['2005'].values)</code>
  but I get <code>ValueError: cannot copy sequence with size 6 to array axis with dimension 5
  </code> So I'm not really sure how to proceed. Is there a simple way to do this that I am not seeing? I think there should be an easy way to do this in place so you don't have to construct a new dataframe each time. I also tried the <code>sub()</code> method but the subtraction is only applied to the first row whereas I want to subtract the first row from each row in the dataframe.</p>