Complete the code to import the function used for goodness of fit test from scipy.stats.
from scipy.stats import [1]
The chisquare function from scipy.stats is used to perform the chi-square goodness of fit test.
Complete the code to perform a chi-square goodness of fit test on observed data.
observed = [20, 30, 50] expected = [25, 25, 50] stat, p_value = chisquare(f_obs=[1], f_exp=expected)
f_obs.The f_obs parameter requires the observed frequencies, so we pass the observed list.
Fix the error in the code to correctly calculate the chi-square test statistic and p-value.
from scipy.stats import chisquare observed = [15, 25, 60] expected = [20, 20, 60] stat, p_value = chisquare(f_obs=observed, f_exp=[1])
The f_exp parameter must be the expected frequencies, so expected is correct.
Fill both blanks to create a dictionary comprehension that maps each category to its observed frequency only if the frequency is greater than 20.
categories = ['A', 'B', 'C', 'D'] observed = [10, 25, 30, 15] result = {categories[i]: [1] for i in range(len(categories)) if [2]
The dictionary maps category names to observed frequencies, but only includes those where the frequency is greater than 20.
Fill all three blanks to create a dictionary comprehension that maps uppercase category names to observed frequencies only if the frequency is less than or equal to 25.
categories = ['a', 'b', 'c', 'd'] observed = [10, 25, 30, 15] result = { [1]: [2] for i in range(len(categories)) if [3] }
The dictionary comprehension maps uppercase category names to observed frequencies, including only those frequencies less than or equal to 25.