Trying to perform rfm on my database. In order to calculate number of days using below code -
Have converted my dates into date form while importing data to python using below SQL query -
to_char (r.created_at, 'yyyy-mm-dd') user_created,
to_char (t.created_at, 'yyyy-mm-dd') transaction_cre ated
But getting following error upon execution - "TypeError: descriptor 'date' requires a 'datetime.datet ime' object but received a 'int' "
Could anyone help me out with this? Would highly appreciate it.
Code:
sd = dt.date(2019, 8, 1) data['hist']=sd - data['transaction_created'] data['hist'].astype('timedelta64[D]') data['hist']=data['hist'] / np.timedelta64(1, 'D') data.head()
to_char (r.created_at, 'yyyy-mm-dd') user_created,
to_char (t.created_at, 'yyyy-mm-dd') transaction_cre ated
But getting following error upon execution - "TypeError: descriptor 'date' requires a 'datetime.datet ime' object but received a 'int' "
Could anyone help me out with this? Would highly appreciate it.
Comment