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)')

22nd Apr 2020, 2:49 AM
Sid
Sid - avatar
4 Respuestas
0
Which line does the error ref?
22nd Apr 2020, 4:29 AM
Diego Lesmes
Diego Lesmes - avatar
0
File "app.py", line 11, in <module>
22nd Apr 2020, 5:12 AM
Sid
Sid - avatar
0
line 10: you named the pretty table t and not table, did you?
22nd Apr 2020, 6:52 AM
Lisa
Lisa - avatar
0
Yeah even if I'm giving t also it's giving me error
22nd Apr 2020, 7:01 AM
Sid
Sid - avatar