Skip to content

Instantly share code, notes, and snippets.

@meraldo-aliz
Last active March 2, 2022 03:45
Show Gist options
  • Save meraldo-aliz/5aa7fea373017c754d28427b2febcea5 to your computer and use it in GitHub Desktop.
Save meraldo-aliz/5aa7fea373017c754d28427b2febcea5 to your computer and use it in GitHub Desktop.
lifetimes
from lifetimes.utils import summary_data_from_transaction_data
rfm = summary_data_from_transaction_data(transactions=transactions,
customer_id_col='customer_id',
datetime_col='date',
monetary_value_col = 'amount',
observation_period_end=pd.to_datetime('1998-06-30'),
freq='W')
rfm.head(3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment