title: converting daily stock data to weekly-based via pandas in Python
body: <p>I've got a <code>DataFrame</code> storing daily-based data which is as below:</p>
  
  <pre><code>Date              Open        High         Low       Close   Volume
  2010-01-04   38.660000   39.299999   38.509998   39.279999  1293400   
  2010-01-05   39.389999   39.520000   39.029999   39.430000  1261400   
  2010-01-06   39.549999   40.700001   39.020000   40.250000  1879800   
  2010-01-07   40.090000   40.349998   39.910000   40.090000   836400   
  2010-01-08   40.139999   40.310001   39.720001   40.290001   654600   
  2010-01-11   40.209999   40.520000   40.040001   40.290001   963600   
  2010-01-12   40.160000   40.340000   39.279999   39.980000  1012800   
  2010-01-13   39.930000   40.669998   39.709999   40.560001  1773400   
  2010-01-14   40.490002   40.970001   40.189999   40.520000  1240600   
  2010-01-15   40.570000   40.939999   40.099998   40.450001  1244200   
  </code></pre>
  
  <p>What I intend to do is to merge it into weekly-based data. After grouping:</p>
  
  <ol>
  <li>the <strong>Date</strong> should be every Monday (at this point, holidays scenario should be considered when Monday is not a trading day, we should apply the first trading day in current week as the Date).</li>
  <li><strong>Open</strong> should be Monday's (or the first trading day of current week) Open.</li>
  <li><strong>Close</strong> should be Friday's (or the last trading day of current week) Close.</li>
  <li><strong>High</strong> should be the highest High of trading days in current week.</li>
  <li><strong>Low</strong> should be the lowest Low of trading days in current week.</li>
  <li><strong>Volumn</strong> should be the sum of all Volumes of trading days in current week.</li>
  </ol>
  
  <p>which should look like this:</p>
  
  <pre><code>Date              Open        High         Low       Close   Volume
  2010-01-04   38.660000   40.700001   38.509998   40.290001  5925600   
  2010-01-11   40.209999   40.970001   39.279999   40.450001  6234600   
  </code></pre>
  
  <p>Currently, my code snippet is as below, which function should I use to mapping daily-based data to the expected weekly-based data? Many thanks!</p>
  
  <pre><code>import pandas_datareader.data as web
  
  start = datetime.datetime(2010, 1, 1)
  end = datetime.datetime(2016, 12, 31)
  f = web.DataReader("MNST", "yahoo", start, end, session=session)
  print f
  </code></pre>