Request: Better error message for missing columns in aggregate · Issue #32755 · pandas-dev/pandas (original) (raw)
When attempting to aggregate a non-existing column, this error is raised, which is not very descriptive: SpecificationError: nested renamer is not supported
In [39]: pd.DataFrame([[1, 2]], columns=['A', 'B']).groupby('A').agg({'B': 'mean'})
Out[39]:
B
A
1 2
In [40]: pd.DataFrame([[1, 2]], columns=['A', 'B']).groupby('A').agg({'B': 'mean', 'non-existing': 'mean'})
Out[40]:
...
SpecificationError: nested renamer is not supported