rfm = df3.groupby('CustomerID').agg({
'InvoiceNo' : lambda num: len(num),
'TotalSum' : lambda price: price.sum(),
'InvoiceDay': lambda x: ref_date- x.max()})
rfm.rename(columns={
'InvoiceNo' : 'Frequency',
'TotalSum' : 'Monetary',
'InvoiceDay': 'Recency'
}, inplace=True)
rfm['Recency'] = rfm['Recency'].dt.days
rfm.hist()
plt.show()
It keeps showing this error, I don't know what I'm doing wrong here:
TypeError: 'NoneType' object is not callable
I was expecting a histogram plot of the 3 different variables. If I don't have rfm.hist(column= 'Recency')
, it still shows the same error. What is the issue here?
These are the dtypes
:
Frequency int64
Monetary float64
Recency int64
Output exceeds the size limit. Open the full output data in a text editor
TypeError Traceback (most recent call last) File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/getlimits.py:459, in finfo.new(cls, dtype) 458 try: --> 459 dtype = numeric.dtype(dtype) 460 except TypeError: 461 # In case a float instance was given
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last) /Users/Downloads/Unclassified Learning/Unclassified Learning.ipynb Cell 25 in <cell line: 2>() 1 rfm.hist() ----> 2 plt.show()
File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/matplotlib/pyplot.py:389, in show(*args, **kwargs) 345 """ 346 Display all open figures. 347 (...) 386 explicitly there. 387 """ 388 _warn_if_gui_out_of_main_thread() ... --> 462 dtype = numeric.dtype(type(dtype)) 464 obj = cls._finfo_cache.get(dtype, None) 465 if obj is not None:
TypeError: 'NoneType' object is not callable