A/b testing for shoofly.com step 8

I got an error with my script and having a hard time trying to debug. Can someone please help? This is for the a/b testing for shoefly.com step 8:

my script:

print(ad_clicks
.groupby([‘experimental_group’, ‘is_click’])
.user_id
.count()
.reset_index()
.pivot(
index = ‘experimental_group’,
columns = ‘is_click’,
values = ‘user_id’
)/
.reset_index()
)

Error:

File “script.py”, line 52
.reset_index()
^
SyntaxError: invalid syntax

Also, need help debugging question 10. Not sure why I’m getting this error.

For each group ( a_clicks and b_clicks ), calculate the percent of users who clicked on the ad by day .

My script:

a_clicks_pivot = a_clicks
.groupby([‘is_click’, ‘day’]).user_id
.count()
.reset_index()
.pivot(
index = ‘day’,
columns = ‘is_click’,
values = ‘user_id’
)
.reset_index()

a_clicks_pivot[‘percent_clicked’] = a_clicks_pivot[True] / (a_clicks_pivot[True] + a_clicks_pivot[False])

print(a_clicks_pivot)

b_clicks_pivot = b_clicks
.groupby([‘is_click’, ‘day’]).user_id
.count()
.reset_index()
.pivot(
index = ‘day’,
columns = ‘is_click’,
values = ‘user_id’
)
.reset_index()

b_clicks_pivot[‘percent_clicked’] = b_clicks_pivot[True] / (b_clicks_pivot[True] + b_clicks_pivot[False])

print(b_clicks_pivot)

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.