title: Python loop over dataframe
body: <p>I have a dataframe consisting of ticker prices.   It is 1 row per TICKER, DATE, PRICE, for a year.  So, 365 rows per ticker.   The structure is somewhat like this:</p>
  <pre><code>    TICKER  PRICE_DATE  OPEN_PRICE
  0      IBM    20201113      115.19
  1      IBM    20201112      115.63
  2      IBM    20201111      118.12
  3      IBM    20201110      116.69
  4      IBM    20201109      117.88
  .
  .
  .
  #      AAPL   20201113      115.19
  #      AAPL   20201112      115.63
  #      AAPL   20201111      118.12
  #      AAPL   20201110      116.69
  #      AAPL   20201109      117.88
  </code></pre>
  <p>What I need to do is:  for each ticker, loop through the first 3 days, and compare the OPEN price with the previous day.   Basically something like:      IF day1 &lt; day2 &lt; day3 THEN.........</p>
  <p>So, I need 3 rows of IBM, next iteration I need 3 rows of AAPL, next iteration.........</p>
  <p>Any easy way to do this?    Or, maybe I am supposed to convert this to a different format, so I can access AAPL, price element 1, price element 2, price element 3, etc?</p>