Skip to content
Course Notes: Customer Analytics and A/B Testing in Python
Course Notes
Use this workspace to take notes, store code snippets, or build your own interactive cheatsheet! The datasets used in this course are available in the datasets folder.
# Import any packages you want to use here
import pandas as pd
import datetime as dt
from datetime import timedelta
conv_sub_data = pd.read_csv('datasets/AB_testing_exercise.csv')
Take Notes
Add notes here about the concepts you've learned and code cells with code you want to keep.
Add your notes here
# Add your code snippets here
# The maxiumum date in our dataset
current_date = pd.to_datetime('2023-03-25')
#Limti to users who have had a week to subscribe
max_lpse_date = current_date - timedelta(days=7)
conv_sub_data = sub_data_demo[
sub_data_demo['lapse_date'] < max_lapse_date]
# Calculate how many days it took the user to subscribe
conv_sub_data['sub_time'] = (conv_sub_data.subscription_date - conv_sub_data.lapse_date.dt.days)