Hypothesis-testing, SciPy, projects—familiar


copied the solution from the video. Why do i have an error message?


Is a function and requires parentheses. So, double check all your print() statements.

Thanks but it didnt work. I put brackets on all my print statement but still get same error. Also there are no brackets in the tutorial

Parentheses, not brackets. ( ) vs. [ ]

I know. It’s an old project using Python 2. (I originally did it in 2017 as part of a Data Analyst intensive course).
I would have thought they switched it to Python 3 by now. (I just looked at my completed project and I added parens, and the code works, so perhaps it’s been updated to Python3).

Did you put parens around print(iron_contingency_table) ?
Also, what’s happening on line 24 with the underscores?
And, as the error message says, there’s a non-ASCII character on line 28. Note: it might not be on line 28, but above it.

yes sorry i meant parentheses. I put parentheses on all print statements. i have parentheses on iron contingency table and the underscores are as per the video for the chi2 test. I’ve since added in chi2, iron_pvalue, dof, expected but still no luck.
What is non-ASC11 character?

The issue is the underscores. (I’m not sure what it says in the video b/c I never watched it).

What happens if you remove the underscores and write the code like this?

iron_pvalue = chi2_contingency(iron_contingency_table)

As for non-ASCII characters, you can visit the address in the error message:
(there’s always info in error messages and it’s v. helpful to learn how to read them to debug your code).

Still no! Same error. Thanks for your help on this. I think I’ve learnt to live with it now. I did a Chi test in the next project (Dog fostering) and that worked out fine so I feel like I’ve learnt the concept and have one good example to go back to and consult if need be. Thanks again!

1 Like