Probability and statistics | Sololearn: Learn to code for FREE!

0

Probability and statistics

Hi while i'm executing below getting error like Indentation error : unindent does not match any outer Indentation level Ingency if np.any (observed < 0) TypeError : '<' not supported between instances of 'Prettytable' and 'init' from prettytable import PrettyTable t = PrettyTable(['Marital Status','Middle school', 'High School','Bachelor','Masters','PhD']) t.add_row(['Single',18,36,21,9,6]) t.add_row(['Married',12,36,45,36,21]) t.add_row(['Divorced',6,9,9,3,3]) t.add_row(['Widowed',3,9,9,6,3]) print (t) from scipy.stats import chi2_contingency from scipy.stats import chi2 stat,p,dof,expected = chi2_contingency(table) prob = 0.95 critical = chi2.ppf(prob, dof) if abs(stat) >= critical: print('Dependent (reject H0)') else: print('Independent (fail to reject H0)')

4/22/2020 2:49:02 AM

Sid

4 Answers

New Answer

0

Which line does the error ref?

0

File "app.py", line 11, in <module>

0

line 10: you named the pretty table t and not table, did you?

0

Yeah even if I'm giving t also it's giving me error