A/B Testing for ShoeFly.com question 5

project : https://www.codecademy.com/paths/data-science/tracks/data-processing-pandas/modules/dspath-agg-pandas/projects/pandas-shoefly-ab-test

question 5 asks: Now let’s pivot the data so that the columns are is_click (either True or False ), the index is utm_source , and the values are user_id .

Save your results to the variable clicks_pivot

i followed along with the youtube video and it did not work so i copied the code from the hint clicks_pivot = clicks_by_source\ .pivot(index='utm_source', columns='is_click', values='user_id')\ .reset_index()

and get the error : Traceback (most recent call last):
File “script.py”, line 15, in
clicks_pivot = clicks_by_source
AttributeError: ‘function’ object has no attribute ‘pivot’

me too!!! I don’t know why

Can anyone answer please? I’m desperate for help!

HI @nguynkiuchi189263598. Without seeing what code you’ve implemented it is hard to know exactly why you have encountered an error. Could supply your script with proper formatting as per the guidance on this post-

If your error is similar to the one in the original post I’d hazard a guess before this line there was an object method referenced but not called, e.g. something like the following-

value = object.method

Instead of

value = object.method()

Be aware when you’re looking for help on the forums of just how long ago the previous reply was. For a question back in August 2019 it’s probably worth starting a new topic and referencing this original query only if you need to.
Hopefully the object.method issue is the answer to your query but if not hopefully we can hunt it down. Ta.

1 Like

Hey, I got the same error and found my mistake! In my case the error resulted from the previous question.

In question 4, when asked to fill the variable clicks_by_source, I put in a reset_index at the end without brackets. Changing it to reset_index() fixed the error in question 5

1 Like

Thank you. I’ll take notes