You used numpy's where function well to create ab_test_group. This is just for your reference, but another method to create ab_test_group is using a lambda and pandas' .apply() function:
df['ab_test_group'] = df.fitness_test_date.apply(lambda x:
'A' if pd.notnull(x) else 'B')
You used numpy's where function well to create ab_test_group. This is just for your reference, but another method to create ab_test_group is using a lambda and pandas' .apply() function: