title: Most frequent occurence in a pandas dataframe indexed by datetime
body: <p>I have a large <code>DataFrame</code> which is indexed by <code>datetime</code>, in particular, by days. I am looking for an efficient function which, for each column, checks the most common non-null value in each week, and outputs a dataframe which is indexed by weeks consisting of these within-week most common values.</p>
  
  <p>Here is an example. The following <code>DataFrame</code> consists of two weeks of daily data:</p>
  
  <pre><code>                        0      1    
  2015-11-12 00:00:00     8     nan   
  2015-11-13 00:00:00     7     nan   
  2015-11-14 00:00:00     nan   5   
  2015-11-15 00:00:00     7     nan   
  2015-11-16 00:00:00     8     nan   
  2015-11-17 00:00:00     7     nan   
  2015-11-18 00:00:00     5     nan   
  2015-11-19 00:00:00     9     nan   
  2015-11-20 00:00:00     8     nan   
  2015-11-21 00:00:00     6     nan   
  2015-11-22 00:00:00     6     nan   
  2015-11-23 00:00:00     6     nan   
  2015-11-24 00:00:00     6     nan   
  2015-11-25 00:00:00     2     nan   
  </code></pre>
  
  <p>and should be transformed into:</p>
  
  <pre><code>                        0    1    
  2015-11-12 00:00:00     7    5
  2015-11-19 00:00:00     6    nan
  </code></pre>
  
  <p>My <code>DataFrame</code> is very large so efficiency is important. Thanks.</p>
  
  <p><strong>EDIT</strong>: If possible, can someone suggest a method that would be applicable if the entries are tuples (instead of floats as in my example)?</p>