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