Код: #create RMF Моделирование баллов для каждого клиента Значения, хранящиеся в кадре данных RFMscore
RFMscore = sales_data.groupby('CustomerID').agg({'InvoiceDate': lambda x: (Last_date - x.max()).days,
'InvoiceNo': lambda x: len(x), 'TotalAmount': lambda x: x.sum()})
Ошибка:
<ipython-input-23-b3e30f63aebe> in <module>()
4 #create RMF Modelling scores for each customer Values stored in dataframe RFMscore
5
----> 6 RFMscore = sales_data.groupby('CustomerID').agg({'InvoiceDate': lambda x: (Last_date - x.max()).days, 'InvoiceNo': lambda x: len(x), 'TotalAmount': lambda x: x.sum()})
7
8 #convert invoicedate to int so that mathematical operations can be done easily
1 frames
/usr/local/lib/python3.6/dist-packages/pandas/core/base.py in _aggregate(self, arg, *args, **kwargs)
355 obj.columns.intersection(keys)
356 ) != len(keys):
--> 357 raise SpecificationError("nested renamer is not supported")
358
359 from pandas.core.reshape.concat import concat
SpecificationError: nested renamer is not supported```