Skip to content

Instantly share code, notes, and snippets.

@kurasaiteja
Created August 14, 2020 13:22
Show Gist options
  • Save kurasaiteja/ac13b879e1a0567b992eeecc84ddfb5b to your computer and use it in GitHub Desktop.
Save kurasaiteja/ac13b879e1a0567b992eeecc84ddfb5b to your computer and use it in GitHub Desktop.
best_churn = pd.DataFrame(last_transaction)
#Convert the cutoff_day to date time format
cutoff_day = pd.to_datetime("01/05/20")
def d(date):
if date < cutoff_day:
return 1
else:
return 0
# Creating a boolean column to denote churn status
best_churn["churned"] = best_churn["transaction_date"].apply(d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment