Jul-26-2021, 07:15 AM
This is due to the way GroupBy objects handle the different aggregation methods. In fact sum and mean are handled differently. GroupBy.mean dispatches to self._cython_agg_general which checks for numeric types and in case it doesn't find any it raises a DataError.