Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialNancy Melucci
Courses Plus Student 36,143 PointsWhy doesn't this work? top_referrals_index = users.where(users['referral_count'] > 4 & users['email_verified'] == True)
Optional Challenge 1, I feel like I've tried everything but it keeps failing the tests. Can anyone see why the email_verified check is returning some False values?
4 Answers
Megan Amendola
Treehouse TeacherIt looks like you're missing some parentheses (). You want to surround your expressions with parentheses to control the order of operations. The example given at the bottom of this instruction step is a good reference. I also removed the 'where' using the example as my guide. See if this works for you.
top_referrals_index = users[(users['referral_count'] >= 5) & (users['email_verified'] == True)]
Nancy Melucci
Courses Plus Student 36,143 PointsOK, I cleared the kernel, ran everything again, in order, and I copy/pasted your code. It still fails. Stumped.
Megan Amendola
Treehouse TeacherNo worries! We'll figure this out :)
Here's how I am inputting the above statement into the binder. Are you doing it the same way?
Nancy Melucci
Courses Plus Student 36,143 PointsThe link is asking for a password...thanks for your patient help. NJM
Megan Amendola
Treehouse TeacherAh all these new Zoom requirements and features :facepalm: Here you go! Password: F1X+6k=#
Nancy Melucci
Courses Plus Student 36,143 PointsOK, so apparently Jupyter was angry that I made a new cell and ran it...that was the actual problem
Thank you so much. I really do appreciate your patience.
Megan Amendola
Treehouse TeacherYou're welcome :)
Nancy Melucci
Courses Plus Student 36,143 PointsNancy Melucci
Courses Plus Student 36,143 PointsThis looks good, and it looks like one of the versions I tried by consulting various pandas resources on the inter-webs. It still fails all the tests based on not having only TRUEs and having some returns with less than 5 referral counts. However, when I view the whole data frame for top_referrals_index, the output is correct (so, the answer should work, and probably so should some of mine.)
Is it possible there is something wrong with the testing program? Thanks for responding. I hope we can figure this out. I know it's optional because I'd like to pass it.
Megan Amendola
Treehouse TeacherMegan Amendola
Treehouse TeacherHey, Nancy!
I tried the above in the binder notebook and it passes all tests for me. I left it as:
users[(users['referral_count'] >= 5) & (users['email_verified'] == True)]
I tried at first the recommended Kernel > Restart and Run All but that didn't change the table view at all so instead I ran each cell individually and that changed the table view and showed that I passed all tests. Try running each cell from the top-down individually and see how that goes.