There are two ways to use the apply function. If you have a data frame you have to set the axis=1 argument. However in case of pandas series that argument is redundant since there is only one column. Check there is no axis argument here:
https://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.apply.html
So I would do:
df['ab_test_group'] = df.fitness_test_date.apply(lambda x:
'A' if pd.notnull(x) else 'B')
https://github.com/seebe1c/Capstone-Option-1-MuscleHub-A-B-Test/blob/54eb409b0b9fc2b245bc63afeb74aeee763629dc/MuscleHub%20Solutions_christa.py#L91-L93
There are two ways to use the apply function. If you have a data frame you have to set the
axis=1
argument. However in case of pandas series that argument is redundant since there is only one column. Check there is no axis argument here: https://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.apply.htmlSo I would do: