Stuck in Step 10 of pandas-shoefly-ab-test

Hello there,

I’m stuck at step 10 for the above referenced link and I’m receiving the error:

File “”, line 39


SyntaxError: invalid syntax

after inputting the following (which is, I believe, identical to the instructors code on the follow along video: reference time 11:34):

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

  1. I’m not sure why there’s an error to a line with no code?
  2. What is the actual error? I fairly positive that I’ve entered everything correctly.

thanks all,


I’m not able to test it but unexpected syntax errors are often unmatched parentheses. Have a quick browse through your code to ensure there are no hanging brackets without a partner.

If you wanted to submit small code snippets to the forums then the following FAQ would help preserve formatting. Lengthy codes are generally discouraged though and something like github would be a better shout if it was necessary to link a longer script.

You were correct!

Now i get this:
Traceback (most recent call last):
File “”, line 30, in
.groupby([‘is_click’, ‘day’].user_id
AttributeError: ‘list’ object has no attribute ‘user_id’

There’s an expression in there of [‘is_click’, ‘day’].user_id which creates a list and attempts to access an attribute with the name user_id. Since there is no attribute of this object with this name your error is thrown.

Are you sure this is executing in the order you expect? Do you have a similar previous task you can look back on to ensure what you expect to happen matches the correct syntax? Since parentheses can alter the evaluation order of expressions are they all where they should be?

It’s the same code as the instructors on the video linked in the project - that’s why I’m confused as to why it’s happening.

I found it!

Was a missing set of parenthesis.

1 Like

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