militrusted.blogg.se

No numeric types to aggregate
No numeric types to aggregate












no numeric types to aggregate

> 1022 how, alt=alt, numeric_only=numeric_only, min_count=min_countġ024 return self._wrap_agged_blocks(agg_blocks, items=agg_items) You can aggregate non-numeric types, using first () and similar methods at /pandas-docs/stable/userguide/ The error message triggers specifically when trying to do a numeric aggregation, e.g. anaconda/envs/azureml_p圓6/lib/python3.6/site-packages/pandas/core/groupby/generic.py in _cython_agg_general(self, how, alt, numeric_only, min_count)ġ021 agg_blocks, agg_items = self._cython_agg_blocks( Raise code): obj lectedobj objvals obj.values data obj.mgr if numericonly and not isnumericdtype(obj.dtype): raise DataError('No numeric types to aggregate') This is overkill because it is only called once, but is here to mirror the arrayfunc used in DataFrameGroupBy.cythonagggeneral def arrayfunc(values: ArrayLike) -> ArrayLike: try: result. anaconda/envs/azureml_p圓6/lib/python3.6/site-packages/pandas/core/groupby/groupby.py in mean(self, numeric_only)ġ397 alt=lambda x, axis: Series(x).mean(numeric_only=numeric_only), anaconda/envs/azureml_p圓6/lib/python3.6/site-packages/pandas/core/base.py in _try_aggregate_string_function(self, arg, *args, **kwargs)Ģ65 # people may try to aggregate on a non-callable attribute > 307 return self._try_aggregate_string_function(arg, *args, **kwargs), None

no numeric types to aggregate

anaconda/envs/azureml_p圓6/lib/python3.6/site-packages/pandas/core/base.py in _aggregate(self, arg, *args, **kwargs) > 951 result, how = self._aggregate(func, *args, **kwargs) Answers 2:of 'No numeric types to aggregate' while using Pandas expanding() If you want to join the previous rows values to the next inside the group, perhaps you could use cumsumand add strings as you go: tmp'expadingjoin' tmp.groupby('col1')'col2'.apply(lambda x: (x + ',').cumsum()).str. anaconda/envs/azureml_p圓6/lib/python3.6/site-packages/pandas/core/groupby/generic.py in aggregate(self, func, engine, engine_kwargs, *args, **kwargs) anaconda/envs/azureml_p圓6/lib/python3.6/site-packages/pandas/core/reshape/pivot.py in pivot_table(data, values, index, columns, aggfunc, fill_value, margins, dropna, margins_name, observed)ġ11 grouped = oupby(keys, observed=observed)ġ13 if dropna and isinstance(agged, ABCDataFrame) and len(lumns): > 12 user_training_interaction = pd.pivot_table(trainingtaken, index='User-Id', columns='Training-Id', values='TrainingTaken')ġ3 user_training_interaction.fillna(0,inplace=True)ġ4 user_training_csr = csr_matrix(user_training_interaction.values) BUG: DataError: No numeric types to aggregate on . No numeric types to aggregate change in groupby() behaviour How are you generating your data See how the output shows that your data is of ‘object’ type the groupby operations specifically check whether each column is a numeric dtype first. DataError Traceback (most recent call last)














No numeric types to aggregate