title: Python - Pandas - groupby and "agg" - set aggregate to nan when group contains a nan
body: <p>I have the following example:</p>
  
  <pre><code>index_ = pd.date_range('2001-01-01', '2010-12-31', freq = 'MS')
  df_ = pd.DataFrame(np.random.randn(len(index_), 4), columns=list('ABCD'),  index = index_ )
  df_.loc['2009-01-01','A'] = np.nan
  df_.loc['2007-08-01','B'] = np.nan
  df_.groupby(pd.TimeGrouper('A')).agg({'A': np.sum, 'B': np.mean})
  </code></pre>
  
  <p>I like to have that column 'B' is <code>NaN</code> in 2007 and column 'A' is <code>NaN</code> in 2009. How can this be achieved? I tried the <code>np.sum</code> function because in numpy arrays it returns <code>NaN</code> when the array contains a nan value. Can this be translated to the "agg" command which I would like to use here.</p>