Exception raised by agg when the functions are ill-specified.
The exception raised in two scenarios.
The first way is calling agg on a Dataframe or Series using a nested renamer (dict-of-dict).
The second way is calling agg on a Dataframe with duplicated functions names without assigning column name.
Examples
>>> df = pd.DataFrame({'A': [1, 1, 1, 2, 2],
... 'B': range(5),
... 'C': range(5)})
>>> df.groupby('A').B.agg({'foo': 'count'})
... # SpecificationError: nested renamer is not supported
>>> df.groupby('A').agg({'B': {'foo': ['sum', 'max']}})
... # SpecificationError: nested renamer is not supported
>>> df.groupby('A').agg(['min', 'min'])
... # SpecificationError: nested renamer is not supported
© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.errors.SpecificationError.html