Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All groupby statements in generate_lag_features cause SpecificationError("nested renamer is not supported") #1

Open
adonnini opened this issue Mar 19, 2024 · 0 comments

Comments

@adonnini
Copy link

Hi,
I am attempting to use your project to predict store sales for a small chain of bakeries.
I am using the source code extracted from the jupyter notebooks directly.
In generate_lag_features in several places you use the pandas groupby function. For example:

gb = sales.groupby(index_cols,as_index=False).agg({'item_cnt_day':{'target':'sum'}})

I am using pandas 2.2.1. The above statement generates the traceback reported below.

Based on seaches I ran the error SpecificationError("nested renamer is not supported") is caused by this construct

agg({'item_cnt_day':{'target':'sum'}})

I read the comment in the noteboook regarding the above line. Frankly, I am not sufficiently familiar with your code to try and change the above construct so as to resolve the error.

Could you help me?

Thanks

TRACEBACK LOG

Traceback (most recent call last):
  File "/home/adonnini1/Development/ContextQSourceCode/NeuralNetworks/RetailSalesForecasting/Sales_Forecasting_Project/downloadedNotebooks/generate_lag_features.py", line 68, in <module>
    gb = sales.groupby(index_cols,as_index=False).agg({'item_cnt_day':{'target':'sum'}})
  File "/usr/local/lib/python3.10/site-packages/pandas/core/groupby/generic.py", line 1432, in aggregate
    result = op.agg()
  File "/usr/local/lib/python3.10/site-packages/pandas/core/apply.py", line 190, in agg
    return self.agg_dict_like()
  File "/usr/local/lib/python3.10/site-packages/pandas/core/apply.py", line 423, in agg_dict_like
    return self.agg_or_apply_dict_like(op_name="agg")
  File "/usr/local/lib/python3.10/site-packages/pandas/core/apply.py", line 1608, in agg_or_apply_dict_like
    result_index, result_data = self.compute_dict_like(
  File "/usr/local/lib/python3.10/site-packages/pandas/core/apply.py", line 462, in compute_dict_like
    func = self.normalize_dictlike_arg(op_name, selected_obj, func)
  File "/usr/local/lib/python3.10/site-packages/pandas/core/apply.py", line 655, in normalize_dictlike_arg
    raise SpecificationError("nested renamer is not supported")
pandas.errors.SpecificationError: nested renamer is not supported
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant