Skip to content

Instantly share code, notes, and snippets.

@meraldo-aliz
Last active March 2, 2022 03:46
Show Gist options
  • Save meraldo-aliz/a7031585ee0b128a4916da7ab403fd15 to your computer and use it in GitHub Desktop.
Save meraldo-aliz/a7031585ee0b128a4916da7ab403fd15 to your computer and use it in GitHub Desktop.
lifetimes
import pandas as pd
from lifetimes.datasets import load_dataset
transactions = load_dataset(
filename='CDNOW_sample.txt',
header=None,
delim_whitespace=True,
names=['customer_id', 'customer_index', 'date', 'quantity', 'amount'],
converters={'date': lambda x: pd.to_datetime(x, format="%Y%m%d")}
)
transactions.head(3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment