ddd-fun / intro-data-capstone-musclehub

0 stars 0 forks source link

Good use of numpy's where #3

Closed Caealana closed 6 years ago

Caealana commented 6 years ago
screenshot at may 13 10-26-59

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')
ddd-fun commented 6 years ago

Thanks a lot for lambda reference. With this code I've just explored numpy lib.