Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sandy4321/21c8b0919f75260d40c8b8d82a72284e to your computer and use it in GitHub Desktop.
Save Sandy4321/21c8b0919f75260d40c8b8d82a72284e to your computer and use it in GitHub Desktop.
import numpy as np
import pandas as pd
campaign_data = pd.read_csv("cashback_activation_data.csv")
campaign_data = campaign_data.sort_values(['customer_id', 'timestamp'],
ascending=[False, True])
campaign_data['visit_order'] = campaign_data.groupby('customer_id').cumcount() + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment