Complete the code to import the chi2_contingency function from scipy.stats.
from scipy.stats import [1]
The chi2_contingency function is the correct function to perform the chi-squared test on a contingency table.
Complete the code to create a 2x2 contingency table using a list of lists.
table = [[20, 15], [[1], 30]]
The missing value in the table is 25 to complete the 2x2 contingency table.
Fix the error in the code to perform the chi-squared test on the table.
chi2, p, dof, expected = [1](table)The correct function to call is chi2_contingency to perform the chi-squared test.
Fill both blanks to create a dictionary comprehension that maps each category to its expected count if the expected count is greater than 20.
result = {category: expected.flatten()[[1]] for [2], category in enumerate(['A', 'B', 'C', 'D']) if expected.flatten()[[1]] > 20}We use i as the index from enumerate to access the expected counts by position.
Fill all three blanks to create a dictionary comprehension that maps each category name in uppercase to its expected count if the count is less than 25.
filtered = {category[1](): expected.flatten()[[2]] for [3], category in enumerate(['A', 'B', 'C', 'D']) if expected.flatten()[[2]] < 25}.lower() instead of .upper().The method .upper() converts the category to uppercase. The index i from enumerate accesses the expected counts.