title: Getting Average of Pandas with GroupBy- Getting DataError: No numeric types to aggregate -
body: <p>I know that there are numerous questions about this, like <a href="https://stackoverflow.com/questions/19329160/getting-daily-averages-with-pandas">Getting daily averages with pandas</a>
  and <a href="https://stackoverflow.com/questions/21030171/how-get-monthly-mean-in-pandas-using-groupby">How get monthly mean in pandas using groupby</a> but I'm getting a weird error. </p>
  
  <p>Simple data set, with one index column (type timestamp) and one value column. 
  Would like to get the monthly mean of the data. </p>
  
  <pre><code>In [76]: df.head()
  Out[76]: 
                            A
  2008-01-02                1
  2008-01-03                2
  2008-01-04                3
  2008-01-07                4
  2008-01-08                5
  </code></pre>
  
  <p>However, when I groupby, I get just the groups of the index and not of the value</p>
  
  <pre><code>In [74]: df.head().groupby(lambda x: x.month).groups
  Out[74]: 
  {1: [Timestamp('2008-01-02 00:00:00'),
    Timestamp('2008-01-03 00:00:00'),
    Timestamp('2008-01-04 00:00:00'),
    Timestamp('2008-01-07 00:00:00'),
    Timestamp('2008-01-08 00:00:00')]}
  </code></pre>
  
  <p>Attempts to take means() result in an error: </p>
  
  <p>Have tried both <code>df.head().resample("M", how='mean')</code> and <code>df.head().groupby(lambda x: x.month).mean()</code></p>
  
  <p>and gets the error: <code>DataError: No numeric types to aggregate</code></p>
  
  <pre><code>In [75]: df.resample("M", how='mean')
  ---------------------------------------------------------------------------
  DataError                                 Traceback (most recent call last)
  &lt;ipython-input-75-79dc1a060ba4&gt; in &lt;module&gt;()
  ----&gt; 1 df.resample("M", how='mean')
  
  /usr/local/lib/python2.7/site-packages/pandas/core/generic.pyc in resample(self, rule, how, axis, fill_method, closed, label, convention, kind, loffset, limit, base)
     2878                               fill_method=fill_method, convention=convention,
     2879                               limit=limit, base=base)
  -&gt; 2880         return sampler.resample(self).__finalize__(self)
     2881 
     2882     def first(self, offset):
  
  /usr/local/lib/python2.7/site-packages/pandas/tseries/resample.pyc in resample(self, obj)
       82 
       83         if isinstance(ax, DatetimeIndex):
  ---&gt; 84             rs = self._resample_timestamps()
       85         elif isinstance(ax, PeriodIndex):
       86             offset = to_offset(self.freq)
  
  /usr/local/lib/python2.7/site-packages/pandas/tseries/resample.pyc in _resample_timestamps(self)
      286             # Irregular data, have to use groupby
      287             grouped = obj.groupby(grouper, axis=self.axis)
  --&gt; 288             result = grouped.aggregate(self._agg_method)
      289 
      290             if self.fill_method is not None:
  
  /usr/local/lib/python2.7/site-packages/pandas/core/groupby.pyc in aggregate(self, arg, *args, **kwargs)
     2436     def aggregate(self, arg, *args, **kwargs):
     2437         if isinstance(arg, compat.string_types):
  -&gt; 2438             return getattr(self, arg)(*args, **kwargs)
     2439 
     2440         result = OrderedDict()
  
  /usr/local/lib/python2.7/site-packages/pandas/core/groupby.pyc in mean(self)
      664         """
      665         try:
  --&gt; 666             return self._cython_agg_general('mean')
      667         except GroupByError:
      668             raise
  
  /usr/local/lib/python2.7/site-packages/pandas/core/groupby.pyc in _cython_agg_general(self, how, numeric_only)
     2356 
     2357     def _cython_agg_general(self, how, numeric_only=True):
  -&gt; 2358         new_items, new_blocks = self._cython_agg_blocks(how, numeric_only=numeric_only)
     2359         return self._wrap_agged_blocks(new_items, new_blocks)
     2360 
  
  /usr/local/lib/python2.7/site-packages/pandas/core/groupby.pyc in _cython_agg_blocks(self, how, numeric_only)
     2406 
     2407         if len(new_blocks) == 0:
  -&gt; 2408             raise DataError('No numeric types to aggregate')
     2409 
     2410         return data.items, new_blocks
  
  DataError: No numeric types to aggregate
  </code></pre>