While I was doing the project for the pandas aggregate function class at Codecademy (https://www.codecademy.com/courses/data-processing-pandas/projects/pandas-shoefly-ab-test), I wasn’t able to get through an exercise, more specifically exercise number 6. The exercise asked the student to do the following:
6.Create a new column in
percent_clicked which is equal to the percent of users who clicked on the ad from each
Was there a difference in click rates for each source?
The table he is referring to is this:
False represents the users who didn’t click on it and True represents the user who clicked.
The code I used was this:
clicks_pivot['percent_clicked'] = clicks_pivot[True] / (clicks_pivot[True] + clicks_pivot[False])
I tried everything but I always got the same error message: KeyError: True
Can anyone help me?