title: Accessing Row from Previous Day in Pandas Dataframe with Apply
body: <p>Im new to pandas and am trying to run a calculation on every row that uses the closing price from <strong>yesterday</strong> and prices from <strong>today</strong>. ie:</p>
  
  <pre><code>for 2011-07-26:
      new_column = max(df.high['2011-07-25'], df.close['2011-07-26'])
  </code></pre>
  
  <p>I thought about using iterating through all the rows, but thought it would be more efficient to use df.apply function. But, I cannot figure out how to access the previous days closing price from within my function.</p>
  
  <p>Here is a snippet of my dataframe.</p>
  
  <pre><code>              open    high     low   close
  date                                      
  2011-07-22  1597.6  1607.7  1597.5  1601.5
  2011-07-25  1618.2  1620.3  1609.4  1612.2
  2011-07-26  1610.7  1617.5  1608.0  1616.8
  </code></pre>
  
  <p>whats the best way to accomplish this? </p>