A/B Testing for Shoefly.com Question #6


#1

This is the exercise link

On Question #6 I came up with another row-based solution vs the column based one which is the following:

Row-based answer:

clicks_pivot[‘percent_clicked’]=clicks_pivot.apply((lambda row: 1.0*(row[True]/(row[False]+row[True]))),axis=1)

For reference this is the “official solution”:

clicks_pivot[‘percent_clicked’]=1.0*(clicks_pivot[True]/(clicks_pivot[False]+clicks_pivot[True]))

Why does my row-based approach not work?

Thanks!